|
|
Warp wrote:
> Darren New <dne### [at] sanrrcom> wrote:
>> Most other languages don't futz with the class of the object while it's
>> being constructed, so it doesn't really come up, I guess. One of the
>> costs of multiple inheritance as implemented by C++?
>
> I don't understand what multiple inheritance has to do with this.
The need for multiple vtables in the final class. Well, it's not
specifically multiple inheritance, but rather the fact that vtables are
indexed with fixed indecies for virtual functions, which means you have
to modify the base pointer if you have more than one parent class.
If you only have one chain of inheritance, then the virtual functions in
child classes can always come after the virtual functions in parent
classes without conflict. If you have multiple inheritance, two parent
classes might assign the same index to two different virtual functions,
and something that inherits from both needs to disambiguate.
--
Darren New / San Diego, CA, USA (PST)
Remember the good old days, when we
used to complain about cryptography
being export-restricted?
Post a reply to this message
|
|