+ 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

7th Feb 2018, 1:18 AM
jacky
3 Antworten
7th Feb 2018, 1:24 AM
Vukan
Vukan - avatar
+ 4
7th Feb 2018, 10:09 AM
Alex
Alex - avatar
+ 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.
7th Feb 2018, 2:00 AM
Jacob Pembleton
Jacob Pembleton - avatar