Introduction to OOP Chapter 13: Multiple Inheritance: next previous audio real text

Data Field in Common Ancestor

Imagine that the common ancestor declares a data member. Should the child class have one copy of this data field, or two?

Both answers can be justified with examples.

C++ gets around this by introducing the idea of a virtual parent class. If your parent is virtual there is one copy, and if not there is two.

Not a perfect solution, and makes the language complicated.

Intro OOP, Chapter 13, Slide 14