I have been using different methods that are used in Objective-C. Can any one give a good explanation of the difference between following methods?
void append(NSString *msg);
-(void) append:(NSString *)msg;
+(void)append:(NSString *)msg)
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.
void append(NSString *msg)is a C function. Unlike Objective-C methods, C functions are called using parentheses rather than the Objective-C bracket notation. C functions are often seen in iOS in lower-level components and frameworks, such as the graphics libraries.-(void) append:(NSString *)msgis an instance method. This means, that the method must be called on an instance of whatever class it has been written into.This differs from
+(void) append:(NSString *)msg, which is a class method. This means that the method must be called on the class itself, not on any single instance of the class. Class methods are usually reserved for utility methods that are general in nature, and not instance-specific.