C++ Friend Function in a Class

Objectives :

  • testClassFriend1.cpp
    A Friend Function in a class, exposes all the class members to all the external classes.
  • In this example the uses of public and friend functions are compared side by side

Step: 1 Create a source file.

Step: 2 Edit and save Source file

Step: 3 Runtime Views:

Step: