Answers for "why friend function is used in c++"

C++
4

friend function in c++

class className{
  // Other Declarations
  friend returnType functionName(arg list);
};
Posted by: Guest on September-01-2021
1

use of friend function

We require friend functions whenever we have to 
access the private or protected members of a class. This is 
only the case when we do not want to use the objects of that 
class to access these private or protected members.
Posted by: Guest on August-23-2021

Browse Popular Code Answers by Language