Home » C++ Programming » References

What will be the output of the program given below? #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; }

← Previous Next →

Discussion & Comments

No comments yet. Be the first to comment!