0
下面的代碼給我一個錯誤:「BankAccount沒有可見的@interface聲明選擇器getAccountNumber」 爲什麼?請幫助沒有可見的@interface
// BankAccount.h
#import <Foundation/Foundation.h>
@interface BankAccount: NSObject
@property long accountNumber;
@end
// BankAccount.m
#import "BankAccount.h"
@implementation BankAccount
@end
//main.m
#import <Foundation/Foundation.h>
#import "BankAccount.h"
int main (int argc, const char * argv[]) {
BankAccount *account1 = [[BankAccount alloc] init];
[account1 setAccountNumber: 34543212];
NSLog(@" Account No = %li", [account1 getAccountNumber]);
return 0;
}
在最近版本的工具中不需要'@ synthesize' –
合成與否合併與否不會改變問題,他正在使用它。 –
Whops沒有看到編輯。 –