Features
- Friendships are not corresponded – If class
A
is a friend of classB
, classB
is not automatically a friend of classA
. - Friendships are not transitive – If class
A
is a friend of classB
, and classB
is a friend of classC
, classA
is not automatically a friend of classC
. - Friendships are not inherited – A friend of class
Base
is not automatically a friend of classDerived
and vice versa; equally ifBase
is a friend of another class,Derived
is not automatically a friend and vice versa. - Access due to friendship is inherited – A friend of
Derived
can access the restricted members ofDerived
that were inherited fromBase
. Note though that a friend ofDerived
only has access to members inherited fromBase
to which Derived has access itself, e.g. ifDerived
inherits publicly fromBase
,Derived
only has access to the protected (and public) members inherited fromBase
, not the private members, so neither does a friend.
Read more about this topic: Friend Class
Famous quotes containing the word features:
“It looks as if
Some pallid thing had squashed its features flat
And its eyes shut with overeagerness
To see what people found so interesting
In one another, and had gone to sleep
Of its own stupid lack of understanding,
Or broken its white neck of mushroom stuff
Short off, and died against the windowpane.”
—Robert Frost (18741963)
“These, then, will be some of the features of democracy ... it will be, in all likelihood, an agreeable, lawless, particolored commonwealth, dealing with all alike on a footing of equality, whether they be really equal or not.”
—Plato (c. 427347 B.C.)
“Each reader discovers for himself that, with respect to the simpler features of nature, succeeding poets have done little else than copy his similes.”
—Henry David Thoreau (18171862)