Re: How call upper layer function
Re: How call upper layer function
- Subject: Re: How call upper layer function
- From: Quincey Morris <email@hidden>
- Date: Wed, 20 Apr 2011 12:12:53 -0700
On Apr 20, 2011, at 11:34, Rodrigo Zanatta Silva wrote:
> //Finally in "LevelDown.m" i have
> #import "LevelDown.h"
>
> @implementation LevelDown
> - (id)initWithLevelUp: (LevelUp *)levelUp; {
> self = [super init];
> LevelUp* myLevelUp = levelUp;
> [myLevelUp doSomething]; //Everything work, but this will give-me a problem
> return self;
> }
> @end
You need:
> #import "LevelDown.h"
> #import "LevelUp.h"
>
> @implementation LevelDown
> - (id)initWithLevelUp: (LevelUp *)levelUp; {
> self = [super init];
> LevelUp* myLevelUp = levelUp;
> [myLevelUp doSomething]; //Everything work, but this will give-me a problem
> return self;
> }
> @end
The @class solves the circular reference in the .h files, but you must still include the actual interface in any compilation unit that uses the class.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden