Features
- Friendships are not corresponded – If class
Ais a friend of classB, classBis not automatically a friend of classA. - Friendships are not transitive – If class
Ais a friend of classB, and classBis a friend of classC, classAis not automatically a friend of classC. - Friendships are not inherited – A friend of class
Baseis not automatically a friend of classDerivedand vice versa; equally ifBaseis a friend of another class,Derivedis not automatically a friend and vice versa. - Access due to friendship is inherited – A friend of
Derivedcan access the restricted members ofDerivedthat were inherited fromBase. Note though that a friend ofDerivedonly has access to members inherited fromBaseto which Derived has access itself, e.g. ifDerivedinherits publicly fromBase,Derivedonly 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.)
“Art is the child of Nature; yes,
Her darling child, in whom we trace
The features of the mothers face,
Her aspect and her attitude.”
—Henry Wadsworth Longfellow (18071882)