This documentation is archived and is not being maintained.

Compiler Error C2683

dynamic_cast : 'type' is not a polymorphic type

You cannot use dynamic_cast to convert from a non-polymorphic class (a class with no virtual functions).

You can use static_cast to perform conversions of non-polymorphic types. However, static_cast does not perform a run-time check.

Example

// C2683.cpp
class B { };
class D : public B { };

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