#include<iostream.h> class CuriousTab { static int x; public: static void SetData(int xx) { x = xx; } static void Display() { cout<< x ; } }; int CuriousTab::x = 0; int main() { CuriousTab::SetData(44); CuriousTab::Display(); return 0; }
#include<iostream.h> int main() { int x = 0; int &y = x; y = 5; while(x <= 5) { cout<< y++ << " "; x++; } cout<< x; return 0; }
#include<iostream.h> class CuriousTab { int a, b, c; public: void SetValue(int x, int y ,int z) { a = x; b = y; c = z; } void Display() { cout<< a << " " << b << " " << c; } }; int main() { CuriousTab objCuriousTab; int x = 2; int &y = x; y = 5; objCuriousTab.SetValue(x, ++y, x + y); objCuriousTab.Display(); return 0; }
#include<iostream.h> class CuriousTabBase { public: int x, y; public: CuriousTabBase(int xx = 0, int yy = 0) { x = xx; y = yy; } }; class CuriousTabDerived : public CuriousTabBase { private: CuriousTabBase objBase; public: CuriousTabDerived(int xx, int yy) : CuriousTabBase(xx), objBase(yy) { cout << this->x << " " << this->y << " " << objBase.x << " " << objBase.y << " "; } ~CuriousTabDerived() { } }; int main() { CuriousTabDerived objDev(11, 22); return 0; }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.