I'm confused about virtual destructors. I have read many questions and explanations but i still didn't understand that if there is a derived class from base class, do i need to implement its own destructor even it doesn't have any special operations.
The compiler compiles the code below, but would be there any memory leaks or any problems ?
Class Base{
public:
virtual ~Base(){}
};
Class Derived : public Base{
// do i need a special destructor here for Derived ?
}
Base *foo;
foo = new Derived;
delete foo;