A
A
Alexander2013-12-24 16:50:48
Objective-C
Alexander, 2013-12-24 16:50:48

What is the difference between a class method and an object method in Objective-C?

Hello, please explain what is the difference between a class method and an object method in Objective-C?
Why is such a division necessary? How and where is it used?
I just used only C++ and Java before. So I have a pattern break :-D. I read the literature, but I didn't fully understand it anywhere.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Solovey, 2013-12-24
@axell24

Well, since they used C++ before, they probably met with static methods. Here they can be considered analogues of class methods. Non-static methods, respectively, are analogous to object methods. Roughly speaking, a class method can be used without creating an instance of that class.

V
Vladislav Ivasik, 2013-12-24
@iqw

Static method - performs some actions, but cannot affect the properties of the ksass. Dynamic - can only be called when an instance of the class (object) is created, but it can access the properties of the object.
In general, in order not to explain for a long time - first read the basics of OOP, they are almost the same for all PLs, for example:
habrahabr.ru/post/87119

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question