#import <Foundation/Foundation.h>
#import "Student.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
Student *ncr=[Student new];
Computer *com=[Computer new];
[ncr playGame:com];
}
return 0;
}
#import <Foundation/Foundation.h>
#import "Computer.h"
@interface Student : NSObject
-(void)playGame:(Computer *)com;
@end
#import <Foundation/Foundation.h>
@interface Computer : NSObject
-(void)game;
@end
#import "Computer.h"
@implementation Computer
-(void)game{
NSLog(@"ncr已经超越神的杀戮了!!");
}
@end
#import "Student.h"
@implementation Student
-(void)playGame:(Computer *)com{
[com game];
}
@end |