T
Thomas Maier-Komor
Hi,
let's assume there is an abstract base class (ABC), which is
inheritet virtually by two classes (A,B). A and B themselves
are inheritet by another class (C). What kind of overhead
should I expect compared to a class X, which implements
the virtual functions of the base classes directly without
an additional inheritance layer? Is it compiler dependent or
are there any fundamental tradeoffs with the implementation
of class C?
Thanks,
Tom
struct ABC
{
virtual int foo() = 0;
virtual float bar() = 0;
};
struct A : public virtual ABC
{
int foo()
{ return 0; }
};
struct B : public virtual ABC
{
float bar()
{ return 0; }
};
struct C : public A, public B
{
};
struct X : public ABC
{
int foo()
{ return 0; }
float bar()
{ return 0; }
};
let's assume there is an abstract base class (ABC), which is
inheritet virtually by two classes (A,B). A and B themselves
are inheritet by another class (C). What kind of overhead
should I expect compared to a class X, which implements
the virtual functions of the base classes directly without
an additional inheritance layer? Is it compiler dependent or
are there any fundamental tradeoffs with the implementation
of class C?
Thanks,
Tom
struct ABC
{
virtual int foo() = 0;
virtual float bar() = 0;
};
struct A : public virtual ABC
{
int foo()
{ return 0; }
};
struct B : public virtual ABC
{
float bar()
{ return 0; }
};
struct C : public A, public B
{
};
struct X : public ABC
{
int foo()
{ return 0; }
float bar()
{ return 0; }
};