The is-a relationships of single inheritance also apply in multiple-inheritance relationships. To demonstrate this, line 29 assigns the address of object derived
to the Base1
pointer base1Ptr
. This is allowed because an object of class Derived
is an object of class Base1
. Line 30 invokes Base1
member function getData
via base1Ptr
to obtain the value of only the Base1
part of the object derived
. Line 33 assigns the address of object derived
to the Base2
pointer base2Ptr
. This is allowed because an object of class Derived
is an object of class Base2
. Line 34 invokes Base2
member function getData
via base2Ptr
to obtain the value of only the Base2
part of the object derived
.
3.138.37.20