Wednesday, May 5, 2010

Back to basics

# @interface declaration is identical to a regular function
# @implementation shows a new keyword: super

* Similar to Java, Objective-C only has one parent class.
* Accessing it's super constructor is done through [super init] and this is required for proper inheritance.
* This returns an instance which you assign to another new keyword, self. Self is similar to this in Java and C++.

# if ( self ) is the same as if ( self != nil ) to make sure that the super constructor successfully returned a new object. nil is Objective-C's form of NULL from C/C++. This is gotten from including NSObject.
# After you've initialized the varialbes, you return yourself with return self;
# The deafult constructor is -(id) init;
# Constructors in Objective-C are technically just "init" methods, they aren't a special construct like they are in C++ and Java.
+ is used. The + denotes a class level function.

http://www.otierney.net/objective-c.html#downloading
http://www.atomicobject.com/pages/The+Objective+C+Language



Interface is a class which contain all unimplemented methods( can call them also abstract methods)
We will implement these methods in derived class of interface.
ie an interface is actually not inherited but implemented.
We cann't create an instance of interface object instead we can create an instance for derived class objects

//////////////////

classes in Objective-C provide the basic construct for encapsulating some data with the actions that operate on that data. An object is a runtime instance of a class,

No comments:

FEEDJIT Live