If I have a simple class like this:
class MyClass
{
MyClass(){}
~MyClass(){}
public:
int myArrayKeyValue;
};
And later, I create an array of these classes:
MyClass testing[10];
How, in the constructor, would I access the array key so I can set the myArrayKeyValue
appropriately for each element of the array? So that I get this:
testing[0].myArrayKeyValue = 0;
testing[1].myArrayKeyValue = 1;
testing[2].myArrayKeyValue = 2;
testing[3].myArrayKeyValue = 3;
etc...
Is it possible to accomplish this in the constructor? Or do I have to just loop through the array and assign the values manually?