C++ Friend Question: Download Questions PDF
List the advantages of using friend classes?
![C++ Friend Interview Answer C++ Friend Interview Question](https://globalguideline.com/public/images/interview/8.png)
Answer:
There are situations when private data members need to be accessed and used by 2 classes simultaneously. In these kind of situations we can introduce friend functions which have an access to the private data members of both the classes. Friend functions need to be declared as 'friend' in both the classes. They need not be members of either of these classes.
Download C++ Friend Interview Questions And Answers
PDF
Previous Question | Next Question |
Explain friend function? | What are the C++ friend classes? Explain its uses with an example? |