The thing you're overlooking is
alloc method. What alloc does is, it allocates memory for that class on which it was called. So when you do
MyClass *obj = [MyClass alloc];
It allocates memory for this particular class object. And when you do following in your init:
self = [super init];
It returns you the same object typically, that is already allocated. Also note, its an instance method (prefixed with
-), it is mere a message to object to properly setup and initialize the class and setting the instance variable's default values etc. Its return type is set to
id to server the purpose of not making it an explicit class like
NSObject because types can mismatch and cause error.
Since class for
MyObject is already allocated and in all parental hierarchy
self will be pointing to
MyObject, that's why returning
self from parent init message doesn't cause conflicts.