Reputation: 15
I have array of objects
MyClass MyArr[10];
In method of one element of array ( MyArr[j] )
I need to access to method of another element in this array ( MyArr[i].Method2(arg) )
.
How I Can do this?
Access from one element of array to another element of array?
Upvotes: 0
Views: 634
Reputation: 41812
There's lots of ways. Some are:
MyArr
a static variable of the MyClass
classMyArr[i]
as a parameter to the method call on MyArr[j]
Upvotes: 1
Reputation: 49822
You can either pass the array to each object, or you might find a linked list worth trying
Upvotes: 0