For example:
class Animal
{
virtual void dummy() {}; //LINE1
}
class Cat : public Animal
{
}
Animal* a = new Cat();
if (Cat* c = dynamic_cast<Cat*> (a)) //LINE2
{
//Do something.
}
If I remove LINE1 from the Animal class (i.e. Animal class does not contain virtual members), LINE2 will not work.