Let\'s say I have a Base class and several Derived classes. Is there any way to cast an object to one of the derived classes without the ne
What are you trying to accomplish, exactly? In my experience, things like this are a sign of bad design. Re-evaluate your class hierarchy, because the goal of object oriented design is make things like this unnecessary.
I think dynamic_cast is the way to go, but I don't particularly think this is a bad design for all possible conditions because object to be casted may be something provided by some third-party module. Let's say object was created by a plug-in that the application author has no knowledge of. And that particular plug-in may create Derived1 (being the old version) type object or Derived2 (being the new version) type object. Maybe the plug-in interface was not designed to do version specific stuff, it just creates the object so the application must do this kind of checking to ensure proper casting/execution. After this, we can safely call object.doSomethingUsefulThatDoesNotExistInDerived1();