R
Rohit
Iam writing an application that uses an abstract base class and a
derived class that is implementation of the abstract base class. Say I
have this piece of code:
Derived *ptrToDerived=NULL;
Base *ptrToBase=NULL;
ptrToDerived= new Derived;
ptrToBase=ptrToDerived;
.....................
.....................
//Do stuff..........
.....................
delete ptrToBase;
Now my doubt is: will the memory be deleted properly. Or what will be
the behaviour of delete in this case, because delete first calls the
destructor of the class, and I have no destructor in the base class.
derived class that is implementation of the abstract base class. Say I
have this piece of code:
Derived *ptrToDerived=NULL;
Base *ptrToBase=NULL;
ptrToDerived= new Derived;
ptrToBase=ptrToDerived;
.....................
.....................
//Do stuff..........
.....................
delete ptrToBase;
Now my doubt is: will the memory be deleted properly. Or what will be
the behaviour of delete in this case, because delete first calls the
destructor of the class, and I have no destructor in the base class.