Lecture 4 - Page 13 : 24
Notes about C++
Abstraction Mechanisms, Part 2
Inheritance in C++
Inheritance: Constructors and destructors
Inheritance: Copying and slicing
Member access control: private, public and protected
Virtual Functions
Destructors and Inheritance - Virtual Destructors
Hiding inherited names
Abstract Classes
What about interfaces in C++?
What about nested classes in C++?
What about prevention of derivation in C++
Pointer to members
Multiple inheritance - issues and C++ solutions
Multiple inheritance - issues and C++ solutions
Multiple inheritance: Ambiguities
Replicated base class
Is repeated inheritance possible?
Is repeated inheritance possible? No!
Shared base class: Virtual base
Base class access
Base class access
Base class access - the C++ rules
Base class access - Examples
Discussion: No single most general class in C++
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 consult
this 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 selection problem:
Do we have means in C to select either x in A or x in B?
The combination problem:
Can x in A and x in B be combined to a single x in C?
The replication problem:
Is there one or two x pieces in C?