Hello everyone,i wrote the following code where i try to convert a base class to a derived using dynamic_cast.I know that dynamic_cast doesn't allow this casting (although static allows it )but i want to ask about the error message which my compiler return:<< 'Base' is not a polymorphic type>>.
What does it mean? How can i make Base class polymorphic in order to succeed the conversion instead of using static_cast?
A polymorphic class is a class with at least a virtual method. If you don't have any method you want to make virtual, you can give it a virtual destructor
If you are experimenting, try overloading the cast operators to do what you want in a safe way.
And I can't think of any situation where this is useful, allot of the polymorphism rules and build in functionality makes downcasting not needed and dangerous.
What are you trying to get out of this experiment?