Connecting Tech Pros Worldwide Forums | Help | Site Map

Re: virtual inheritance

Juha Nieminen
Guest
 
Posts: n/a
#1: Jun 27 '08
Rahul wrote:
Quote:
Should B and C inherit A virtually or should D inherit virtually B
and C?
I'm confused as i'm dealing with a case where A, B and C are provided
by different vendors. B knows that it has to inherit from A but is not
aware about anything else, so is the case with C.
B and C must inherit virtually from A. If they don't and you can't
modify them, then unfortunately there's no way to do it. (This is
because existing compiled code for B and C assume non-virtual
inheritance. This compiled code would be different if the inheritance
was virtual. Thus changing it to virtual would require recompiling that
code.)

Closed Thread