Once the friend declaration is included, the header
class is said to
be a friend of the link
class. Then, all member variables and
member functions in the link
class acts as though they were public
with respect to the member functions of the header
class. Thus, the
member functions of the header
class can get at the constructor,
link
, and the member variables, next_link_pointer
and
element_pointer
, in link
objects.
*-----------------------* Friend *-----------------------* | header | <-------------- | link | | | | | | *-----------------* | Access | *-----------------* | | | Public portion | | permitted | | Private portion | | | | ----------------------------> | | | | | | | | | | | *-----------------* | | *-----------------* | *-----------------------* *-----------------------*