0
나는 다음과 같은 일을 해요 :목표 - C 상속 문제
#import <Foundation/Foundation.h>
#import "CCMenuItem.h"
@interface SmartMenuItem : CCMenuItemSprite {
}
@end
가 그럼 난 내 클래스를 사용하려면 :
SmartMenuItem *playItem = [SmartMenuItem itemFromNormalSprite:play
selectedSprite:playPressed
target:self
selector:@selector(onPlayPressed)];
SmartMenuItem *optionsItem = [SmartMenuItem itemFromNormalSprite:options
selectedSprite:optionsPressed
target:self
selector:@selector(onOptionsPressed)];
[menu_ addChild:playItem];
[menu_ addChild:optionsItem];
그리고 난 오류 및 경고를 받았습니다. 메뉴에는 어린이가 CCMenuItemSprite
으로 허용됩니다. 하지만 xcode는 다음과 같이 말합니다 :의 매개 변수를 SmartMenuItem*
유형의 lvalue로 초기화 할 수 없습니다.
또한 내가 playItem
및 optionsItem
: 메서드를 찾을 수 없을 때 경고 메시지가 나타납니다. 하지만 CCmenuItemSprite의 정적 메서드입니다!
무엇이 문제입니까?