+2 votes
in C Plus Plus by

Consider the following given program and choose the most appropriate output from the given options:

#include<iostream>   

using namespace std;   

class Base {   

public:   

    Base()     

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

    ~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;   

}  

a) Constructing base, Constructing Derived, Destructing Base, Destructing Derived

b) Constructing base, Constructing Derived, Destructing Base

c) Constructing base, Constructing Derived, Destructing Derived, Destructing Base

d) None of the above

1 Answer

0 votes
by

b) Constructing base, Constructing Derived, Destructing Base

Related questions

0 votes
asked Nov 16, 2021 in Azure by Robin
0 votes
asked Aug 30, 2022 in AWS by sharadyadav1986
...