Posted in

Sum of the series Using friend function in C++

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

Output

Please enter a number:

4

Hi, the sum of T4Tutorials_SERIES is:

11106

 CEO @ T4Tutorials.com
I welcome to all of you if you want to discuss about any topic. Researchers, teachers and students are allowed to use the content for non commercial offline purpose. Further, You must use the reference of the website, if you want to use the partial content for research purpose.

Leave a Reply

Contents Copyrights Reserved By T4Tutorials