Re: Class Inheritance vs Interface Inheritance
"sasha" <abc@fox.net> wrote in message
news:el7zdrOdJHA.556@TK2MSFTNGP06.phx.gbl...
Igor Tandetnik wrote:
[snip]
Naturally, Ben meant that it's impossible for any derived class to
"suppress" a call to base class' constructor. He clearly didn't mean
[snip]
Thus, I don't understand your point of stressing virtual inheritance
[snip]
Naturally, Ben meant the immediately derived class. Certainly not that the
ultimate base gets constructed N times.
No, I meant the most derived class and only the most derived class. A
object is only created for this most derived class, the others are "base
subobjects". The term "word" every was to say, no matter how you perform
the derivation, the rule will hold, there is no way to except yourself from
this behavior.
IOW, whenever you create an object (not subobject), at least one constructor
of every base class is called at least once. It is impossible to derive
from a class, directly or indirectly, virtually or not, or with any other
method, such that an object of the derived class is created without ever
calling one of the base's constructors. This is true for every class.
But in case of virtual inheritance, the immediately derived class doesn't
construct the base. The most-derived does.
Hope that clarifies what I'm saying.
Regards,
.a