On 13 Ott, 20:45, Victor Bazarov <v.Abaza...@comAcast.net> wrote:
A doubt? A doubt you have when you are uncertain of some belief or
opinion, or when you lack confidence in your abilities.
You actually just have *two questions*.
Ok, I have two questions.. :-P
> In the following code, why BaseAImpl is
abstract? Deriving it from BaseImpl the IBase::foo() is not defined?
'BaseAImpl' has two objects of type 'IBase'. One inside 'BaseImpl'
subobject, and the other inside the 'IBaseA' subobject. The former
defines the final overrider for 'IBase::foo', the latter does not.
That's why it's abstract. And, no, one base class' final overrider does
NOT become the final overrider for another base class' virtual function.
Thanks, now I understand.
I solved using 'virtual' Inheritance:
class IBase {...};
class IBaseA : virtual public IBase {...};
class BaseImpl : virtual public IBase {...};
class BaseAImpl : public IBaseA, public BaseImpl {...};
In this manner only one IBase object will be created, right?
Right.