-
more class problems!
Hi there,
can someone tell me how i can access data from one class while i'm in another for. i can do it with normal classes but i can't do it with arrarys of classes properly, here's a sample below...
elevator::close_doors
{
person[i].waiting = 1;
}
It won't let me do it, waiting is a public booleen in the person class.
is there a possible way to do this?
Thanks.
Regards,
Smithy.
-
If person is a class, then obviously it will only work if waiting is a public static variable - you would need to access a member variable on an object to even give an array expression any meaning.
Actually it's not at all good programming practice to access global variables from within classes, if you want to access an array of person, from within your another class, make sure either
a. The array is contained in that class
b. A reference to that array is
c. The array reference is passed to the function.