Possible Duplicate:
Objective-C - When to use ‘self’
I can't understand very well the importance and the usage of the "self" keyword in objective-c. It's my first OOP language so i got stuck on some concepts. When i should use "self"? Why is it useful?
Thanks for the answers!
Edit: I can't understand why is this a duplicated post of Objective-C - When to use 'self' when there there is not the explanation of "Self" that i wanted.
self
is a special variable in Objective-C, inside an instance method this variable refers to the receiver(object) of the message that invoked the method, while in a class method self
will indicate which class is calling.
self
refers to the actual object that is executing the current method, it is an invisible argument passed automatically by the runtime environment to your instance methods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With