Do you mean you want to create different structs (with different member types) and name the structs like this:
Code:
struct data_one
{
string Name;
long ID;
string Data;
};
struct data_two
{
string Name;
long ID;
double Speed;
};
struct data_three
{
string Name;
long ID;
bool IsHappy;
bool IsTall;
bool IsSalty;
};
Or do you mean that you want to give a different name to each instance variable, like this:
Code:
struct data_one
{
string Name;
long ID;
};
int main()
{
data_one firstEntry;
data_one secondEntry;
data_one Third_Entry;
}
Or do you mean that you want to be able to specify a different Name property for each instance:
Code:
struct data_one
{
string Name;
long ID;
};
int main()
{
std::vector<data_one> entries(3);
entries.at(0).Name = "Lou";
entries.at(1).Name = "Dave";
entries.at(2).Name = "Charlie";
}
If it's the first, then you probably want another solution, since creating different classes or structs on the fly isn't a good idea. If it's the second, then you don't have to give variable names if the objects are in the vector, you can just access them by their index (see the third example for an example). If it's the third, then you shouldn't have any problem.