+ (void)Foo;
- (void)Foo;
In the method, - (void)Foo
, the keyword self
means an instance of the class.
But in the method, + (void)Foo
, What does the keyword self
mean? Does it mean the Class
?
self
is one of the two implicit parameters to every method. It is a pointer to an object, and initially it is whatever object received the message to invoke the method that's executing. When the method in question is an instance method, self
will be an instance of the class in which the method is defined, or one of its subclasses. In the case of a class method, self
will be the class object.
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