|
-
Sep 9th, 2001, 07:55 PM
#1
Thread Starter
Lively Member
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.
-
Sep 10th, 2001, 03:06 AM
#2
transcendental analytic
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.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|