#include<iostream.h> class CuriousTabBase { protected: int x, y; public: CuriousTabBase(int xx = 0, int yy = 0) { x = xx; y = yy; } void Show() { cout<< x * this->y << endl; } }; class CuriousTabDerived { private: CuriousTabBase objBase; public: CuriousTabDerived(int xx, int yy) : objBase(xx, yy) { objBase.Show(); } ~CuriousTabDerived() { } }; int main() { CuriousTabDerived objDev(10, 20); return 0; }
class Birds {}; class Peacock : protected Birds {};
#include<iostream.h> int main() { int x = 80; int &y = x; x++; cout << x << " " << --y; return 0; }
#include<iostream.h> class A { public: void CuriousTabFunction(void) { cout<< "Class A" << endl; } }; class B: public A { public: void CuriousTabFunction(void) { cout<< "Class B" << endl; } }; class C : public B { public: void CuriousTabFunction(void) { cout<< "Class C" << endl; } }; int main() { A *ptr; B objB; ptr = &objB; ptr = new C(); ptr->CuriousTabFunction(); return 0; }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.