MCQOPTIONS
Saved Bookmarks
| 1. |
What will be the output of the program given below? #include<iostream.h> class BixBase { int x; public: BixBase(int xx = 0) { x = xx; } void Display() { cout<< x ; } }; class BixDerived : public BixBase { int y; public: BixDerived(int yy = 0) { y = yy; } void Display() { cout<< y ; } }; int main() { BixBase objBase(10); BixBase &objRef = objBase; BixDerived objDev(20); objRef = objDev; objDev.Display(); return 0; } |
| A. | 0 |
| B. | 10 |
| C. | 20 |
| D. | Garbage-value |
| E. | It will result in a compile-time/run-time error. |
| Answer» D. Garbage-value | |