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

By: Prof. Dr. Fazal Rehman | Last updated: April 23, 2020

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); … }
 

Leave a Comment

All Copyrights Reserved 2025 Reserved by T4Tutorials