Lecture 5 - Slide 25 : 40
Base class access
A base class in C++ can be either
public
,
protected
, or
private
The C++ Prog. Lang. (3. edition)
:
Page 405
The C++ Prog. Lang. (4. edition)
: Page 605
To see this image you must download and install the
SVG plugin from Adobe
.In Firefox please consult
this page.
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 (when
A
is a private base of
B
)
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