Lecture 4 - Page 21 : 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++
Base class access
A base class in C++ can be either
public
,
protected
, or
private
The C++ Programming Language
: Page 405
To see this image you must download and install the
SVG plugin from Adobe
.In Firefox please consult
this page.
The class B is a specialization of class A
Are the public members in
A
also always public in
B
?
In the 'normal case' they are - public base
In a more 'restricted case' they are not - private or protected bases
When is more restricted access control to base classes useful?
In some contexts the public interface of
A
will be part of the public interface of
B
In other cases,
A
is used internally in
B
, and
A
should not affect the client interface of
B
B
is implemented in terms of
A
B
is
not
an
A