Friend Class Example in C++
If we make the entire class as a friend the automatically all the member functions of the class become friends. For class B to be a friend of class A. The class A must
explicitly declare class B is its friend in the public section
Simple Program for Friend Class Using C++ Programming
Explanation of the program
Here sample1 and sample2 are 2 classes and sample2 is a friend of sample1. Hence, sample2 can access all the
private data members and member functions of the sample1 class.
© 2016-2019, Codeverb.com - All Rights Reserved