InterviewSolution
Saved Bookmarks
| 1. |
Which of the following describes a friend class?(a) Friend class can access all the private members of the class, of which it is a friend(b) Friend class can only access protected members of the class, of which it is a friend(c) Friend class don’t have any implementation(d) Friend class can’t access any data member of another class but can use it’s methodsI got this question during an online interview.I'm obligated to ask this question of Classes in portion OOPs Concept & Features of Object Oriented Programming |
|
Answer» RIGHT answer is (a) FRIEND class can access all the private members of the class, of which it is a friend The explanation: A friend class can access all the private members of another class, of which it is a friend. It is a SPECIAL class provided to use when you need to reuse the data of a class but don’t WANT that class to have those special functions. |
|