What is the difference of using:
+ (id) myMethod;
// Rather than
- (id) myMethod;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Using a
+declares the method as a class method, or a method that can be called directly on the class, where the class is the object. So when you have this:The methods are called in different ways:
One other thing to note is that class methods don’t have access to an instance, which means they can’t access any kind of instance variables.