static method alternative

This commit is contained in:
Mert Gör 🇹🇷 2023-08-03 23:47:57 +03:00
parent 50630be6f0
commit 76a020b50c
No known key found for this signature in database
GPG Key ID: 2100A876D55B39B9
2 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,7 @@
class Sample:
def foo(): # bu nasıl metot?
print('foo')
Sample.foo() # geçerli
s = Sample()
#s.foo() # error!

View File

@ -0,0 +1,7 @@
class Sample:
def foo(): # bu nasıl metot?
print('foo')
Sample.foo() # geçerli
s = Sample()
s.foo() # error!