hat is the output of the given code?   #include using namespace std; class Base { pub

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter13: Overloading And Templates
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

What is the output of the given code?

 

#include<iostream>

using namespace std;

class Base {

public:

Base()

{ cout<<"Constructing Base \n"; }

virtual~Base()

{ cout<<"Destructing Base \n"; }

};

class Derived: public Base {

public:

Derived()

{ cout<<"Constructing Derived \n"; }

~Derived()

{ cout<<"Destructing Derived \n"; }

};

 

int main(void)

{

Derived *d = new Derived();

Base *b = d;

delete b;

return 0;

}

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning