In following example, b
is a polymorphic pointer type whose static type is Base*
and whose dynamic type is Derived*
.
struct Base
{
virtual void f();
};
struct Derived : Base
{
};
int main()
{
Base *b = new Derived();
// ...
delete b;
}
What happens when b
is deleted without a virtual destructor?