The Big Nerd Ranch Guide 제 2 판에서 객관적 - C 프로그래밍을 배우고 있습니다. 내가 쉽게 장 (18)에 입수했습니다하지만 지금은 그 엑스 코드 내가 선언되지 않은 식별자 'heightInMeters'의 구문 오류 "사용을 경험하고 업데이트되었습니다. 여기에 NSObject의 서브 클래스와 목표 - C 내 코드입니다.선언되지 않은 식별자 사용
***AppDelegate.h***
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>
{
// BNRPerson has two instance variables
float _heightInMeters;
int _weightInKilos;
}
// BNRPerson has methods to read and set its instance variables
- (float)heightInMeters;
- (void)setHeightInMeters:(float)h;
- (int)weightInKilos;
- (void)setWeightInKilos:(int)w;
// BNRPerson has a method that calculates the Body Mass Index
- (float)bodyMassIndex;
@end
***AppDelegate.m***
#import "AppDelegate.h"
@interface AppDelegate()
@property (weak) IBOutlet NSWindow *window;
@end
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
- (float)heightInMeters *USE OF UNDECLARED IDENTIFIER 'heightInMeters'
{
return _heightInMeters;
}
- (void)setHeightInMeters:(float)h
{
_heightInMeters=h;
}
- (int)weightInKilos
{
return _weightInKilos;
}
- (void)setWeightInKilos:(int)w
{
_weightInKilos=w;
}
- (float)bodyMassIndex
{
return _weightInKilos/(_heightInMeters * _heightInMeters);
}
}
- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}
@end
:'' - (void) applicationDidFinishLaunching : (NSNotification *) a 알림 { - (float) heightInMeters * 비 식별 IDENTIFIER의 사용 'heightInMeters'' –