OBJECTIVE C Kurt Ladendorf
General Knowledge Super set of C Smalltalk Mainly used for iOS and other Apple development
Data types int, double, float, char, BOOL (YES, NO) id long, long long, short Signed/unsigned Nil
Control structures If Switch For Do while Try catch finally
Methods Method template: -(void) setScore : (int) score andTime : (int) time; Method call [objectName setScore: 12 andTime: 47];
Arrays Immutable Derived from NSArray Mutable Derived from NSMutableArray
Array Example
Classes Base classes normally are children of NSObject Instance methods Denoted by a - Class methods Denoted by a +
Inheritance Single inheritance Overriding a function Use same function prototype and return type ChildClass : ParentClass
Instantiating Objects Create a pointer and then call the object’s allocate and initialize methods ClassName *foo = [[ClassName alloc] init];
Categories Used to customize a class Naming conflicts can arise! Cannot add instance variables Declaring a category ClassName (CategoryName) Has section
Point.h Point.m
Links! C_2.0_Essentials C_2.0_Essentials