Destructor in c++

What is the output of c++ program given below :

#include iostream.h
class Base
{
    public:
       Base(){ cout<<"Constructing Base";}

     // this is a destructor:

 ~Base(){ cout<<"Destroying Base";}
};

class Derive: public Base
{
        public:
        Derive(){ cout<<"Constructing Derive";}

        ~Derive(){ cout<<"Destroying Derive";}
 };

void main()
{
     Base *basePtr = new Derive();

        delete basePtr;
}

Comments

Popular posts from this blog