#include<iostream.h> class CuriousTabBase { int x; public: CuriousTabBase(int xx = 0) { x = xx; } void Display() { cout<< x ; } }; class CuriousTabDerived : public CuriousTabBase { int y; public: CuriousTabDerived(int yy = 0) { y = yy; } void Display() { cout<< y ; } }; int main() { CuriousTabBase objBase(10); CuriousTabBase &objRef = objBase; CuriousTabDerived objDev(20); objRef = objDev; objDev.Display(); return 0; }
#include<iostream.h> int main() { int x = 80; int &y = x; x++; cout << x << " " << --y; return 0; }
#include<iostream.h> int main() { int x = 10; int &y = x; x++; cout<< x << " " << y++; return 0; }
#include <iostream.h> enum xyz { a, b, c }; int main() { int x = a, y = b, z = c; int &p = x, &q = y, &r = z; p = z; p = ++q; q = ++p; z = ++q + p++; cout<< p << " " << q << " " << z; return 0; }
#include<iostream.h> int CuriousTabFunction(int m) { m *= m; return((10)*(m /= m)); } int main() { int c = 9, *d = &c, e; int &z = e; e = CuriousTabFunction(c-- % 3? ++*d :(*d *= *d)); z = z + e / 10; cout<< c << " " << e; return 0; }
#include<iostream.h> class CuriousTab { int x, y; public: void SetValue(int &xx, int &yy) { x = xx++; y = yy; cout<< xx << " " << yy; } }; int main() { int x = 10; int &y = x; CuriousTab objCuriousTab; objCuriousTab.SetValue(x , y); return 0; }
#include<iostream.h> int x, y; class CuriousTabTest { public: CuriousTabTest(int xx = 0, int yy = 0) { x = xx; y = yy; Display(); } void Display() { cout<< x << " " << y << " "; } }; int main() { CuriousTabTest objBT(10, 20); int &rx = x; int &ry = y; ry = x; rx = y; cout<< rx--; return 0; }
#include<iostream.h> enum xyz { a, b, c }; int main() { int x = a, y = b, z = c; int &p = x, &q = y, &r = z; p = ++x; q = ++y; r = ++c; cout<< p << q << r; return 0; }
#include<iostream.h> struct Tab { short n; }; int main() { Tab b; Tab& rb = b; b.n = 5; cout << b.n << " " << rb.n << " "; rb.n = 8; cout << b.n << " " << rb.n; return 0; }
#include<iostream.h> class CuriousTab { int x, y; public: CuriousTab(int xx = 0, int yy = 0) { x = xx; y = yy; } void Display() { cout<< x << " " << y; } CuriousTab operator +(CuriousTab z) { CuriousTab objTemp; objTemp.x = x + z.x; objTemp.y = y + z.y; return objTemp; } }; int main() { CuriousTab objCuriousTab1(90, 80); CuriousTab objCuriousTab2(10, 20); CuriousTab objSum; CuriousTab &objRef = objSum; objRef = objCuriousTab1 + objCuriousTab2; objRef.Display(); return 0; }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.