In order to use a dynamic_cast<> in a C++ program, runtime type information must be enabled. Explicitly marking derived class as implementing interface of base class - C# [ Glasses to protect eyes while coding : https://amzn.to/3N1ISWI ] Explicitly . The choice on the method to wrap structure A in class B is the usual in OO design: B is a A: use inheritance B contains a A, use Composition: make A a memberof B. dynamic_cast Operator | Microsoft Docs The rules are that a pointer to D with some const / volatile qualifications can be converted to a pointer to B with the same qualifiers if B is a base class of D. The standard conversions are implicit conversions with built-in meanings and are separate concepts to things like static_cast or C-style casts. Here's the scenario that I was in that required me to do some filtering and narrowing of my classes. Therefore the conversion from a derived class pointer to a base class pointer is perfectly safe, and happens all the time. Recently, I had the need to convert an object into a descending type. A program can thereby use a class hierarchy safely. In other words, upcasting allows us to treat a derived type as though it were its base type. The dynamic_cast operator (C++ only) The dynamic_cast operator performs type conversions at run time. Is it valid to hide a base class virtual function by making it pure virtual in derived classes - C++ [ Glasses to protect eyes while coding : https://amzn.to. How can I cast a std::shared_ptr<Component> to the correct derived class? Why Down-Casting is required in C# programming? C++ static_cast shared_ptr from base to derived class - Windows Questions In other words, if you can make sure, by other means, that the pointer does indeed point to an instance of the derived class, then you can use static_pointer_cast, but otherwise, it is safer to use dynamic_pointer_cast. 'Derived' class inherits 'Base' class. [Bug c++/28523] [4.0 Regression] Throw of a derived class casted to its base class using a C-style cast. You need a using declaration there in order to bring them into scope.