Answer the question
In order to leave comments, you need to log in
How to create a class representative if we do not initially know how many representatives there will be?
Let's say in a program I read some data from a file. And under certain conditions, I need to bring some data set into the class. (for example, we will assume that when declaring a function, I must enter the return type, function name, type and order of parameters in the class).
But, I don't know how many such ads there can be. It can be either 2-3 or 100-1000.
How to make it so that the declaration creates an instance of the class. ?
While writing, it came to mind to make a dynamic array of classes, and after finding the trigger I need, just create a new element of the array.
Or is there a simpler and more concise option?
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
when declaring a function, I have to put the return type in the class. value, function name, type and order of parameters
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question