类的声明和定义
#import<Foundation/Foundation.h>
XYZPerson.h
@interface Person:NSObject
NSString *name;
@property NSString *firstName;
@property (readonly)NSString *lastName;
@property NSNumber *yearOfBirth;
@property int yearOfBirth;
-(void)someMethodWithFirstValue:(SomeType)info1 secondValue:(anotherType)info2;
-(void)setName:(NSString *)aName;
+(id)stringWithString:(NSString *)aString;
+(void)print;
@end
--------------------------------------------
XYZPerson.m
#import”XYZPerson.h”
@implementation XYZPerson
+(void)print{ NSLog(“。。。”)}
-(void)setName:(NSString *)aName;{ name = aName;}
@end
--------------------------------------------
main.m
[Person print];
ASStudent *student = [[ASStudent alloc] init];
student -> name = @“wu”;
[student setName:@“yang”];
NSLog(@“%@“,[student name]);
[student X] 类似于 c++中的 student.X
[student release]
空对象nil
ASStudent* w = nil
id pid = nil;
int *p = NULL;
pid = NULL