K
KishorAditya
Hi All,
Consider the following scenario:
class Top { };
class Left: virtual public Top { };
class Right: virtual public Top { };
class Bottom: public Left, public Right {};
Many books propose that object of Bottom contains three vptrs, one for
Left and Bottom, one for Right and one for Top.
Now my question is why the compiler is storing superclasses' vptrs in
derived class object. After all Bottom also has a vptr pointing to its
vtable from which it will call all virtual functions.
Thanks in advance.
Consider the following scenario:
class Top { };
class Left: virtual public Top { };
class Right: virtual public Top { };
class Bottom: public Left, public Right {};
Many books propose that object of Bottom contains three vptrs, one for
Left and Bottom, one for Right and one for Top.
Now my question is why the compiler is storing superclasses' vptrs in
derived class object. After all Bottom also has a vptr pointing to its
vtable from which it will call all virtual functions.
Thanks in advance.