Chapter 2: Using classes
Instance Variable, sometimes referred to as ivars, are variables declared for a class that exist and hold their value throughout the life of a corresponding class instance(i.e., object)
Instance Variable Access
@private @protected @public @package
A property differs from an instance variable in that it doesn't directly access an object's internal state, but rather provides a convenient mechanism(getter/setter) for accessing this data, and thus may include other logic. OC declared properties enable the compiler to generate these methods automatically according to your specification.
//Atomicity nonatomic //Setter semantics assign retain copy strong weak //Read/Write readwrite read-only //Method names getter=getterName setter=setterName
A protocol declares methods and properties that can be implemented by any class. A protocol can be used to capture similarities among classes that are not hierarchically related.
A category enables the addition of new functionality to an existing class without subclassing it.
An extension is considered an anonymous category, it differs from a category in that it can declare instance variables and properties, but the methods declared must be implemented in the main @implementation block.
Chapter 3: Objects and Messaging
by overriding the NSObject
Normal forwarding by overriding the NSObject
Chapter 4: Memory management
Automatic data resides in the program stack, a block of memory whose size is usually set prior to program/thread execution, the operating system automatically manages this memory, it's allocated on the stack for and subsequently deallocated at end of scope.
At runtime, an OC program creates objects stored in dynamically allocated memory referred to as the program heap, this needs memory management to ensure proper utilization of system memory.
Memory leaks These are caused when a program does not free unused objects
Dangling pointers These are caused when a program frees objects still being used.