Discussion :: Constructors and Destructors
-
What will be the out of the following program?
#include class GateBase { public: int x, y; public: GateBase(int xx = 0, int yy = 0) { x = xx; y = yy; } }; class GateDerived : public GateBase { private: GateBase objBase; public: GateDerived(int xx, int yy) : GateBase(xx), objBase(yy) { cout " " this->x " " " " this->objBase.x ; } ~GateDerived() { } }; int main() { GateDerived objDev(11, 22); return 0; }
|
A.
11 22 0 0 |
|
B.
11 11 0 22 |
|
C.
11 11 11 0 |
|
D.
11 11 11 22 |
|
E.
The program will report compile time error. |
Answer : Option D
Explanation :
No answer description available for this question.
Be The First To Comment

Whatsapp
Facebook