© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies

Home Lab Exercise Object Oriented Programming Lab Exercise ProgramsCPP Program to Understanding Protected Qualifier Activities▼


CPP Program to Understanding Protected Qualifier Activities

Alogarithm steps:

  1. Create the base class and declare the data member under protected access specifier and declare the function.
  2. Create the derived class and access the base class data members in the derived class.
  3. Create the object for derived class.
  4. Call the public member function of the derived class.
  5. Compile and run the program.

CPP Program to Understanding Protected Qualifier Activities

#include class base { protected: int i, j; //private to base but accessible to derived public: void setij(int a, int b) { i = a; j = b; } void showij() { cout<

SAMPLE INPUT AND OUTPUT:

120 10 12

 
SLogix Student Projects

⇓Student Projects⇓
⇑Student Projects⇑
bottom