class Shape
{
public:
Shape(){ cout<<" Shape"<
virtual ~Shape(){ cout<<" ~ Shape"<
};
class Circle : public Shape
{
public:
Circle() { cout<<"Circle"<< endl; }
~Circle(){ cout<<" ~ Circle" << endl; }
};
int main()
{
Circle *ptr = new Circle();
ptr->~Circle();
ptr->~Circle();
return 1;
}
output:-
# ./a.out
Shape
Circle
~ Circle
~ Shape
~ Shape
while calling the destructor function first time , its calling the base call destructor also ( if its virtual ) . but after that not calling the base class destructor.