Write a c++ program to find out the sum of an A.P. series by using the friend function.

Write a c++ program to find out the sum of an A.P. series by using the friend function.

If we declare a function friend int show(T4Tutorials_AP_Series); as a friend in a class T4Tutorials_AP_Series then this function int show(T4Tutorials_AP_Series);  can access the private and protected members of the class T4Tutorials_AP_Series. You must know that a global function can also be declared as a  friend function of the class.

Syntax of friend function in C++

class class_name
{

friend return_type function_name(arguments);

}

 

Add a Comment