Minggu, 09 April 2017

How friend class works in C++

A friend class is a class which can access the private and protected members of another class. If a class B has to be declared as a friend of class A, it is done as follows: 1 2 3 4 5 6 class A { friend class B; ... ... };   Following are properties of a friend class: A class can be friend of any number of classes. When a class A becomes the friend of class B, class A can access all the members of class B. But class B can access only the public members of class

The post How friend class works in C++ appeared first on Coding Security.


How friend class works in C++
read more

Tidak ada komentar:

Posting Komentar