|Apr 7, 2011, 10:13 PM||#1|
In Init, does self refer to the class or the instance?
Also is there any case where we call alloc and not init after that?
What confuses me is things like
self= [super init]
Basically, if self is a pointer to the class, we're tell self to point to the address described by [super init]
The problem with that is self should already point to whatever address returned by alloc right?
So why change it?
How to Learn Math
|Apr 8, 2011, 02:09 PM||#2|
In any instance method (-), self refers to the instance. In any class method (+), self refers to the class. Always call an init method after calling +alloc. The reason to set it is that some classes play tricks in -init and don't return the same object that +alloc did.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|WHERE TO INIT a CLASS||joak||iPhone/iPad Programming||8||Mar 20, 2014 11:23 AM|
|Assigning new instance of a class to an object that had an instance of the class||moonman239||iPhone/iPad Programming||3||Oct 11, 2013 01:58 PM|
|Class Method -> Function -> Instance Method?||Blakeasd||Mac Programming||11||Jun 19, 2013 03:53 AM|
|How to have user create class instance||Abrexas||iPhone/iPad Programming||21||Mar 28, 2013 01:54 PM|
|Help With Bug: -[NSConcreteValue class]: message sent to deallocated instance||ArtOfWarfare||Mac Programming||5||Jul 12, 2012 12:13 AM|
All times are GMT -5. The time now is 07:23 AM.