Answer the question
In order to leave comments, you need to log in
What is the difference between the concept of OOP in Python and in C-like languages?
Good day.
I'm familiar with python, but I'm still a beginner. To me, as a person who has been writing in C-like languages (Java) for a long time, one thing is not very clear, which is related to the difference between classes and Objects.
In Python, there is a class and, accordingly, a separate entity as an object (or a virtual copy of the class).
But at the same time, when calling the method, it is imperative to pass self, since in Python the method is called precisely in the class, and already thanks to self, this method determines which instance of the class it works with.
class Test:
def f(self):
pass
Answer the question
In order to leave comments, you need to log in
No, it's the same in Java. only variables belong to an instance of a class, and methods are contained in the class itself, just the language notations are different.
How did you write in java for so long and did not learn about the this keyword?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question