I want to cast this:
class Base
{
public:
virtual ~Base(){};
};
class Der : public Base {};
int main()
{
const Base* base = new Der;
Der* der = dynamic_cast<Der*>(base); // Error
return 0;
}
What should I do?
I tried to put: const Der* der = dynamic_cast<Der*>(base);
to mantain the const but this doesn't work.