2009年2月9日 星期一

special keyword in objective-c, id, BOOL, nil, @class

id:
a generic type to refer to any kind of object
ex:
id c = [Circle new];

BOOL:
type for boolean
YES(1) or NO(0)

nil:
1. a zero value
2. a message to nil does not crash, it just do nothing

@class:
when you only need to know the name of class, does not need to know internal structure of class , you can use @class keyword instead of including class header file
ex:
when @class Boy has a instance variable to object dog
use @class Dog
not use #import Dog.h

沒有留言:

張貼留言