// protectedly inherited #include <iostream.h> #include <conio.h> class super { public: void print() { cout << "super class -> print function called"; } }; class sub : protected super { public: void show() { print(); cout << endl << "sub class -> print function called "; } }; void main() { clrscr(); sub obj; obj.show(); getch(); }
Posts
- Get link
- X
- Other Apps
//inheritance // priverly inherited #include <iostream.h> #include <conio.h> class base { public: void show() { cout << "Base class -> show function called"; } }; class derived : private base { public: void print() { show(); cout << endl << "Derived class -> Print function called"; } }; void main() { clrscr(); derived obj; obj.print(); getch(); }
- Get link
- X
- Other Apps
//inheritance // priverly inherited #include <iostream.h> #include <conio.h> class base { public: void show() { cout << "Base class -> show function called"; } }; class derived : private base { public: void print() { show(); cout << endl << "Derived class -> Print function called"; } }; void main() { clrscr(); derived obj; obj.print(); getch(); }