Hello! There is a class:
Class MyClass {...};
make ten copies of it
MyClass _my_new_class1; MyClass _my_new_class2;... MyClass _my_new_class10;
Can you please tell me how to loop through all the instances?
Hello! There is a class:
Class MyClass {...};
make ten copies of it
MyClass _my_new_class1; MyClass _my_new_class2;... MyClass _my_new_class10;
Can you please tell me how to loop through all the instances?
Put in an array and sort through the array.
As already mentioned, to create an array (or any container from STL, best of all, I think the vector will work for this task) with these objects. Or create an array (container) of pointers to objects and bypass them.
Source: https://ru.stackoverflow.com/questions/103972/
All Articles