C++ Program with Friend function to display the pattern like pyramid

By: Prof. Dr. Fazal Rehman | Last updated: March 3, 2022

C++ Program with Friend function to display the pattern like pyramid

Write a C++ Program to display the pattern like pyramid using the alphabet using the friend function. The pattern is as follows :

C++ Program to display the pattern like pyramid using the alphabet.

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