Two Classes Accessing Private Data To Each Other
Sometimes private data members are needed to be accessed and used by two different classes. In that case, friend class (or friend function) can be used. Friend class can access all data members of both the classes, even private and protected data.
For that purpose, each class should be declared as friend in the other class. They should not be member of any one of the classes.
Read more about this topic: Friend Class
Famous quotes containing the words classes, private and/or data:
“Between richer and poorer classes in a free country a mutually respecting antagonism is much healthier than pity on the one hand and dependence on the other, as is, perhaps, the next best thing to fraternal feeling.”
—Charles Horton Cooley (18641929)
“Poetry is not an expression of the party line. Its that time of night, lying in bed, thinking what you really think, making the private world public, thats what the poet does.”
—Allen Ginsberg (b. 1926)
“Mental health data from the 1950s on middle-aged women showed them to be a particularly distressed group, vulnerable to depression and feelings of uselessness. This isnt surprising. If society tells you that your main role is to be attractive to men and you are getting crows feet, and to be a mother to children and yours are leaving home, no wonder you are distressed.”
—Grace Baruch (20th century)