You are probably looking for a rogue index. Pure guess, you have something like this, perhaps:
Person persons[10]; for (i=1; i<=10; i++) persons[i].setName("joel");
The problem may be:
- the error, as shown, the index is based on 0, so you need
for (i=0; i<10; i++) - if the array is allocated dynamically but the index is still out of scope
In fact, there may be hundreds of other reasons, but since I do not have your code, this is my attempt to guess the most plausible errors;)
(Pay attention to yourself: why am I doing this / am I not psychic?)
sehe
source share