Visibility of Methods in Global Classes

...Previous

The output is displayed as below.

Now we shall see how to access a private method of a class. This can be achieved through friend function.

Now create another class ZSAPTECH_FR.in the previous class zsaptech I declared new class zsaptech as friends.  

Now in the zsaptech_fr I created a method as instance and public visibility.

In the implementation of the method I write the code to access the private method of the class zsaptech.

The code of the zprivate method in the zsaptech main class is as below.

Now in the report program I will create an instance of the new class and call the method.

You can see the output. The constructor of the main class also triggered as we had a constructor for the main class.

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image