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?
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.
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];
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