#include<iostream.h> class CuriousTabBase { public: int x, y; CuriousTabBase(int xx = 0, int yy = 5) { x = ++xx; y = --yy; } void Display() { cout<< --y; } ~CuriousTabBase(){} }; class CuriousTabDerived : public CuriousTabBase { public: void Increment() { y++; } void Display() { cout<< --y; } }; int main() { CuriousTabDerived objCuriousTab; objCuriousTab.Increment(); objCuriousTab.Display(); return 0; }
#include<iostream.h> class CuriousTabTeam { int x, y; public: CuriousTabTeam(int xx) { x = ++xx; } void Display() { cout<< --x << " "; } }; int main() { CuriousTabTeam objBT(45); objBT.Display(); int *p = (int*)&objBT; *p = 23; objBT.Display(); return 0; }
#include<iostream.h> class CuriousTab { int x, y; public: CuriousTab(int xx = 10, int yy = 20 ) { x = xx; y = yy; } void Display() { cout<< x << " " << y << endl; } ~CuriousTab() { } }; int main() { CuriousTab objCuriousTab; objCuriousTab.Display(); return 0; }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.