Re: Newbie question...
Re: Newbie question...
- Subject: Re: Newbie question...
- From: email@hidden
- Date: Sun, 17 Feb 2002 16:59:52 -0800
I think that the best way to do this while staying in the OOP guidelines
is to have a class have a pointer to the other class so that it can
access it, then use mutators and accessors to pass information across.
So it'd be the following:
// (Any #import's or @class's necessary, depending on how you organize
your files...)
@interface Foo
{
Bar *myBar;
int aFooInt;
}
- (int)fooInt;
- (void)setFooInt:(int)newInt;
@end
@interface Bar
{
Foo *myFoo;
int aBarInt;
}
- (int)barInt;
- (void)setBarInt:(int)newInt;
@end
Someone please correct me if I'm wrong :-)
On Sunday, February 17, 2002, at 04:22 PM, email@hidden wrote:
How should you pass information across two classes? Should there be a
friend function which is called by one class and gives the info to the
other? Or should some other approach be used? If a friend class
should be used here, what' would the syntax be in objective-c? (i'm
new to the language...)
Thanks for any help
Stef
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.