Objective-c
1.类 对象 方法
@interface
/*
@interface NewClassName:ParentClassName
propertyAndMethodDeclarations; //属性方法声明
@end
*/
@interface Student : NSObject
@property(strong,nonatomic) NSString *name; //声明属性
@property(nonatomic) NSInteger age; //声明属性
-(void)setAge:(int) age andName:(NSString *) name; //声明方法
@end
@implementation
/*
@implementation NewClassName
{
memberDeclarations; //成员变量声明
}
methodsDefinitions; //方法定义
@end
*/
@implementation Student
{
NSString *className; //声明成员变量
}
-(void)setAge:(int) age andName:(NSString *) name; //定义方法
{
self.age=age;
self.name=name;
}
@end
@end