Sum of the series Using friend function in C++

By Prof. Fazal Rehman Shamil
Last modified on April 23rd, 2020

Sum of the series Using friend function in C++.

If we declare a function int show(T4Tutorials_SERIES n) as a friend in a class T4Tutorials_SERIES; then this function show() can access the private and protected members of the class T4Tutorials_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_T4Tutorials

friend return_type function_name(arguments);


Program of Sum of the series in C++

C++ Program to show the  Sum of the series Using friend function


Please enter a number:


Hi, the sum of T4Tutorials_SERIES is:


Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.

Leave a Reply

Your email address will not be published. Required fields are marked *