• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Newbie question... (From: email@hidden)

  • Prev by Date: COCOA API book with examples?
  • Next by Date: Re: Security bug in OS X / Cocoa (NOT!)
  • Previous by thread: Newbie question...
  • Next by thread: Re: Newbie question...
  • Index(es):
    • Date
    • Thread