Objective c language properties and basic description about objective c language.
-(id)init;
-(float)height;
-(void)walk;
Classes respond to class methods
+(id)alloc;
+(id)person;
+(Person*)sharedPerson;
[receiver message:argument];
[receiver message:arg1 andArg: arg2]
Objective-C
- Strict superset of C
- Mix C with ObjC Or even C++ with ObjC (usually referred to as ObjC++)
- A very simple language, but some new syntax
- Single inheritance, classes inherit from one and only one superclass
- Protocols define behavior that cross classes
- Dynamic runtime
- Loosely typed, if you’d like
Class and Instance Methods
Instance respond to instance methods-(id)init;
-(float)height;
-(void)walk;
Classes respond to class methods
+(id)alloc;
+(id)person;
+(Person*)sharedPerson;
Message Syntax
[receiver message];[receiver message:argument];
[receiver message:arg1 andArg: arg2]
Terminology
- Message expression - [receiver method:argument]
- Message - [receiver method:argument]
- Selector - [receiver method:argument]
- Method - The code selected by a message.
0 comments:
Post a Comment