#include<iostream.h> class CuriousTab { int x, y; public: CuriousTab(int xx) { x = ++xx; } ~CuriousTab() { cout<< x - 1 << " "; } void Display() { cout<< --x + 1 << " "; } }; int main() { CuriousTab objCuriousTab(5); objCuriousTab.Display(); int *p = (int*) &objCuriousTab; *p = 40; objCuriousTab.Display(); return 0; }
#include<iostream.h> class CuriousTabTest { public: CuriousTabTest(int &x, int &y) { x++; y++; } }; int main() { int a = 10, b = 20; CuriousTabTest objBT(a, b); cout<< a << " " << b; return 0; }
#include<iostream.h> class CuriousTab { int *p; public: CuriousTab(int xx, char ch) { p = new int(); *p = xx + int(ch); cout<< *p; } ~CuriousTab() { delete p; } }; int main() { CuriousTab objCuriousTab(10, 'B'); return 0; }
#include<iostream.h> struct MyData { public: int Addition(int a, int b = 10) { return (a *= b + 2); } float Addition(int a, float b); }; int main() { MyData data; cout<<data.Addition(1)<<" "; cout<<data.Addition(3, 4); return 0; }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.