Objective-C Flashcards
Who owns Objective C?
Apple
What are the two main Objective-C frameworks used?
Foundation and AppKit
Name three features that Objective-C 2.0 Added?
Garbage Collection, Syntax Enhancement, Runtime Performance Improvmenets
What is the difference between the #include and #import statements?
import has the same function as #include but includes a builtin #include guard.
What are the 5 foundation framework classes in Objective-C?
NSNumber, NSString, NSMutableString, NSArray, NSMutableArray
How is a constructor used in Objective-C?
The method name always starts with init and is called after allocing the required memory.
What is an id?
A datatype that is a pointer to any type of objects and supports dynamic referencing when used as a return type
How is a destructor implemented in Objective-C?
It is always called dealloc and is handled automatically rather than being explicitly called by the program.
What are the two types of memory management used in Objective C?
Manual Retain-Release (MRR) and Automatic Reference Counting (ARC)
How is MRR implemented?
Manage Memory by tracking how many owners an object has, retain and release to register and release ownership of an object. Once an object has 0 owners it is destroyed.
How is ARC implemented?
ARC uses the same process as MRR but it is handled automatically and so release, retrain, and autorelease must not be called explicitly.
How are objects different in Objective-C and C++ different?
In Objective-C objects are based on a message passing paradigm where objects communicate by sending messages to each other whereas in C++ objects conform to a class based paradigm.
What are the advantages of using A wrapper class such as NSNumber?
Type Safety as it allows you to encapsulate all numeric scalar values, Compatability as many API’s in Objective-C expect an object rather than a primative data type.
What are disadvantages of using a wrapper class such as NSNumber?
Performance Overhead and Memory Consumption