+ 5
How to make Collection of objects in c++
please how can I make a collection of objects in c++ or what declaration can I use on arrays to collect a group of objects of a particular class
3 Antworten
+ 4
example for an object vector:
https://code.sololearn.com/cU2KHvrLZQvl/?ref=app
+ 2
You could use an array if you know how many. If not, research containers. Some good ones are vector, which allows you to use it like an array, forward_list, which allows you to iterate through the items forward and add items to the front, and list which allows adding to the front and back, as well as iteration in both directions, but it is a bit slower.