Which of the following describes a friend class?

Phạm Quyết

New member
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 methods
 
Answer: a
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.
 

Tìm kiếm

Back
Top