C++ casting programmatically : can it be done?

后端 未结 8 495
你的背包
你的背包 2021-01-13 06:18

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

8条回答
  •  耶瑟儿~
    2021-01-13 06:54

    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.

提交回复
热议问题