Example 1:
class names:
def myname(self):
return 'my name is python'
word = names().myname()
print(word)
Result:
my name is python
Example 2:
class names:
@classmethod
def myname(cls):
cls.justaname = 'my name is python'
return cls.justaname
word = names().myname()
print(word)
Result:
my name is python
1 - What is the difference between the two methods ?
2 - What changes did '@classmethod' make to the second example ?
3 - I can make the second example work without '@classmethod' decorator so what is the point of adding it is it useless ?