0
@classmethod
I don't fully understand how @classmethod work in python and the use of it. I understand the oop concepts in c++ but this is weird. It's something like constructor in c++?
9 Respostas
+ 3
Abhay i think the author ask about analog @classmethod in c++. I can't answer, because in c++ it is an other rule for classes
+ 3
I am asking if @classmethod works like constructor overloading in c++.
+ 3
Abhay Yes, they are
+ 1
__init__ is a constructor like constructor in c++ ,
Here is a good discussion about class method and static method
https://stackoverflow.com/questions/136097/difference-between-staticmethod-and-classmethod
+ 1
tibi @classmethod is pretty much the same as static methods in c++
Abhay got it right in his first answer: __init__ == constructor