Array of classes, call function in all

Hi,

I have an array of classes. For arguments sake, we will say they are:

MyClass EachClass[100];

Therefore creating 100 instances of class 'MyClass' called EachClass[x].
MyClass has function SetVal(int MyVal);

How can I call this function in all classes? I know I could use a loop, but surely there's a one line solution to this? like EachClass[all].SetVal(12345);
You can use the ctor

1
2
 
MyClass EachClass[100] = MyClass(some_value); 


provided you have ctor

1
2
 
MyClass(int value);
Topic archived. No new replies allowed.