Extension can be added to a class for which you have the source code at compile time.The class extension bears some similarity to a category.
In a class extension if the methods are declared then it is implemented in the implementation block for the original class.
For Example, declare a class extension on a framework class, such as a Cocoa or Cocoa Touch class like NSString.
If there is no category name then Extensions are categories. And can be referred as anonymous categories.
From the above statements, declaration of extension uses the @interface keyword, like a standard Objective-C class description but does not indicate any inheritance from a subclass. Instead, it just adds parentheses.
The below example shows the extension that have a private variable internalID, and method getExternalID which returns the externalID after processing the internalID.
On compiling and executing the above code, the following result is produced:
In the above example, the internalID is not returned directly. Remove the UNIQUEINTERNALKEY and only make the remaining value available to the method getExternalID. here we used a string operation.
Objective C Related Interview Questions
|Python Interview Questions||DBMS Interview Questions|
|C++ Interview Questions||IPHONE APPS Interview Questions|
|C & Data Structures Interview Questions||IOS Interview Questions|
|Java Interview Questions||Go (programming language) Interview Questions|
|F Sharp (programming language) Interview Questions||C preprocessor Interview Questions|
|R Programming language Interview Questions||D Programming Language Interview Questions|
|Lua (programming language) Interview Questions||Embedded C Interview Questions|
Objective C Tutorial
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.