Protected data

20.A program to demonstrate how a protected data of a base class is accessed by the public member function of the derived class through friend class declaration. The derived class has been inherited via public inheritance

21.The following program shows that an error is encountered as a result of an attempt to access the protected data of the base class by the public member function of the derived class via private inheritance. Because of the private derivation, the base class members cannot be accessed by the public members of the derived class even though it has a friendship with base class.

WhatsApp
Hello! Need help with your assignments?

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102

🛡️ Worried About Plagiarism? Run a Free Turnitin Check Today!
Get peace of mind with a 100% AI-Free Report and expert editing assistance.

X