Lecture 4 - Page 9 : 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++
What about interfaces in C++?
Interfaces are well-known from Java and C#, but they do not appear in C++
Why do Java and C# have Interfaces?
Because Java and C# do not support multiple inheritance
Interfaces are the
poor man's remedy
for not having multiple inheritance
How do we make an Interface in C++?
Program a class with only pure virtual functions
A sample C# interface.
The C++ counterpart to the C# Interface.
A C++ class that 'implements the interface' and uses the resulting class.