Storing a list of arbitrary objects in C++

前端 未结 13 2039
野趣味
野趣味 2021-02-06 08:29

In Java, you can have a List of Objects. You can add objects of multiple types, then retrieve them, check their type, and perform the appropriate action for that type.
For e

相关标签:
13条回答
  • 2021-02-06 09:18

    Well, you could create a base class and then create classes which inherit from it. Then, store them in a std::vector.

    0 讨论(0)
提交回复
热议问题