Friend Functions A friend function is a non-member function which can access the private and protected members of a class. To declare an external function as a friend of the class, the function prototype preceded with friend keyword should be included in that class. Syntax for creating a friend function is as follows: 1 2 3 4 5 6 class ClassName { ... friend return–type function–name(params–list); ... }; Following are the properties of a friend function: Friend function is a normal external function which is given special access to the private and protected members of a class. Friend
The post what are friend functions and classes in c++ appeared first on Coding Security.
what are friend functions and classes in c++
read more
Tidak ada komentar:
Posting Komentar