Q72
What will be the output of the following C++ code? #include using namespace std; class Base public: Base() cout<<"Constructing Base "; ~Base() cout<<"Destructing Base "; ; class Derived: public Base public: Derived() cout<<"Constructing Derived "; ~Derived() cout<<"Destructing Derived "; ; int main(void) Derived *d = new Derived(); Base *b = d; delete b; return 0;
A.
Constructing Base
Constructing Derived
Destructing Base
AnswerConstructing Derived
Destructing Base
B.
Constructing Base
Constructing Derived
Destructing Derived
Destructing Base
Constructing Derived
Destructing Derived
Destructing Base
C.
Constructing Base
Constructing Derived
Destructing Base
Destructing Derived
Constructing Derived
Destructing Base
Destructing Derived
D.
Constructing Derived
Constructing Base
Destructing Base
Destructing Derived
Constructing Base
Destructing Base
Destructing Derived
Answer: Option A
Solution
Answer: Option A
No explanation is given for this question Let's Discuss on Board