Storing a list of arbitrary objects in C++

前端 未结 13 2022
野趣味
野趣味 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.

提交回复
热议问题