开发者

Error with @synthesize'd property

开发者 https://www.devze.com 2023-04-06 04:07 出处:网络
I have two classes, GameCharacter and Skeleton. One of the properties on GameCharacter is a delegate of type id:

I have two classes, GameCharacter and Skeleton. One of the properties on GameCharacter is a delegate of type id:

@interface GameCharacter : GameObject
@property (nonatomic, retain) id<GameplayLayerDelegate> delegate;
@end

In the implementation, I have delegate synthesized.

The Skeleton class is pretty straightforward:

#import "GameCharacter.h"

@interface Skeleton : GameCharacter
@end

However, I am unable use delegate in Skeleton without declaring it separately. I receive an error from the compiler. As I understand it, it should inherit it from GameCharacter. What's th开发者_Go百科e problem?


It will inherit from GameCharacter just like any other property or method just make sure you are using self.delegate since using delegate by itself will attempt to access a private ivar (which would be generated in your case).

0

精彩评论

暂无评论...
验证码 换一张
取 消