4

According to Wikipedia:

Class methods are methods that are called on a class (compare this to class instance methods, or object methods).

Could you guys please clarify object methods to me? And Class instance methods are Instance methods if i'm correct?

1
  • This question makes me a Sad panda. Commented Nov 13, 2011 at 19:24

3 Answers 3

3

Yes, Class instance methods = Object methods because Object == Class instance. An object is an instance of a class. From wikipedia:

In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects.

Sign up to request clarification or add additional context in comments.

Comments

3

In objective C class method is used by just class name, you dont need to create a instance of class to access these methods.. But for object methods you need to create an instance of the class which means creating a object of class.. In objective C +/- identifiers are used for it;

@interface AClass: NSObject

+ (void)classMethod;
- (void)instanceMethod;

@end

[AClass classMethod];

AClass *object = [[AClass alloc] init];
[object instanceMethod];

Comments

2

Trying to rephrase the above Wikipedia quote more clearly in the context of Objective C:

Class methods are methods belonging to the class, rather than to an instance of a class.

Instance methods are methods of an instance of a class; which is often referred to as an object. Sayng "class instance methods" obviously refers to this, but is confusing.

1 Comment

Thank you very very much Mr. Paul Lynch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.