Compiler Error C2683

dynamic_cast : 'class' is not a polymorphic type

The dynamic_cast operator cannot be used to convert from a non-polymorphic class, that is, a class that does not define any virtual functions.

You can use the static_cast operator to perform conversions of non-polymorphic types; note, however, that static_cast does not perform a run-time check.

The following is an example of this error:

class B { };
class D : public B {  };

void f(B* pb)
{
    D* pd1 = dynamic_cast<D*>(pb);  // error
}