Lecture overview -- Keyboard shortcut: 'u'  Previous page: Multiple inheritance - issues and C++ solutions -- Keyboard shortcut: 'p'  Next page: Multiple inheritance: Ambiguities -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 4 - Page 14 : 24
Notes about C++
Abstraction Mechanisms, Part 2
Multiple inheritance - issues and C++ solutions

Let us understand the major reason why multiple inheritance is considered problematic

To see this image you must download and install the SVG plugin from Adobe.In Firefox please consultthis page.

Class B is a subclass of class A

  • Concrete problem

    • In a C object ac: Which x does ac.x refer to?

  • General problems

    • The name clash problem: Does x in C refer to the x in A or the x in B?

      • The programmer decides. Use the scope operator: A::x or B::x

    • The selection problem: Do we have means in C to select either x in A or x in B?

      • Yes - as already seen

    • The combination problem: Can x in A and x in B be combined to a single x in C?

      • No - but some control is possible via virtual bases

    • The replication problem: Is there one or two x pieces in C?

      • There are two x variables in a C object