Using the "I" keyword in Objective-C

Possible duplicate:
Objective-C - When to use 'self

I don't understand very well the importance and usage of the "self" keyword in objective-c. This is my first OOP language, so I'm stuck with some concepts. When should I use "I"? Why is this useful?

Thanks for answers!

Edit: I don't understand why this is a duplicated Objective-C post - When to use "I" when there is no "Self" explanation that I wanted.

+3


source to share


1 answer


self

is a special variable in Objective-C, inside an instance method this variable refers to the receiver (object) of the message calling the method, while the class method self

specifies which class to call.



self

refers to the actual object that the current method is executing, this is an invisible argument automatically passed by the runtime to your instance methods.

+13


source







All Articles