Q:

Friend class and function in C++?

0

Friend class and function in C++?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

Friend Class:

A friend class can access private and protected members of other classes in which it is declared as a friend. It is sometimes useful to allow a particular class to access private members of another class.

Friend Function:

A friend’s function can be given a special grant to access private and protected members. A friend function can be:
a) A method of another class
b) A global function

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Interview Questions For Experienced

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
What is the Diamond problem? How can we get around... >>
<< Distinguish between shallow copy and deep copy in ...