Friend Function in C++



class className
{
friend return_type     functionName(argument/s);
}
return_type functionName(argument/s)
{
  .. .. ...
// Private and protected data of
// className can be accessed from
// this function because it is 
//a friend function of className.
... .. ...
}

Examine the above situation and write a program to support the structure explained above.

No comments:

Post a Comment

Comment Here