展开全部
Student.h文件
#import
@interface Student : NSObject
{
NSString *name;
int age;
float score;
}
-(void)setName:(NSString *)newname;
-(NSString *)name;
-(void)setAge:(int)newage;
-(int)age;
-(void)setScore:(float)newscore;
-(float)score;
-(Student *)initWithName:(NSString *)newname andAge:(int)newage andScore:(float)newscore;
+(Student *)studentWithName:(NSString *)newname andAge:(int)newage andScore:(float)newscore;
-(NSComparisonResult)compareWithScore:(Student *)stu;
-(NSComparisonResult)compareWithAge:(Student *)stu;
-(NSComparisonResult)compareWithName:(Student *)stu;
@end
Student.m文件#import "Student.h"
@implementation Student
-(void)setName:(NSString *)newname{
name=newname;
}