This has probably been asked before on SO, but I were unable to find a similar question.
Consider the following class hierarchy:
class BritneySpears
{
public:
virtual ~BritneySpears();
};
class Daughter1 : public BritneySpears
{
public:
virtual ~Daughter1(); // Virtual specifier
};
class Daughter2 : public BritneySpears
{
public:
~Daughter2(); // No virtual specifier
};
Is there a difference between Daughter1
and Daughter2
classes ?
What are the consequences of specifying/not specifying virtual
on a sub-class destructor/method ?
Thanks.