![]() |
![]() |
![]() |
![]() |
![]() |
|
One possible, albeit bad, way to make the link
member variables and constructor accessible is as follows:
header class a subclass of the
link class.
*-----------------------* *-------------------------*
| header | | link |
| | | |
| *-----------------* | Access | *-------------------* |
| | Public portion | | permitted | | Protected portion | |
| | ----------------------------> | |
| | | | | | | |
| *-----------------* | | *-------------------* |
*-----------------------* *-------------------------*
| ^
| Superclass |
*-----------------------------------*
The reason this way to enable access is a bad one is that header
objects are not specialized link objects. Accordingly, to construe
one class as a derived class and the other as its base class would be bad
conceptually. It would be bad practically as well, for then header
objects would carry around element_pointer and
next_link_pointer member variables as excess baggage.