Method overload
This commit is contained in:
parent
95d70e10b7
commit
51db092163
15
python-temel/method.overload.py
Normal file
15
python-temel/method.overload.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
class Sample:
|
||||||
|
def foo(self):
|
||||||
|
print('foo')
|
||||||
|
|
||||||
|
def tar(self):
|
||||||
|
print('bar')
|
||||||
|
|
||||||
|
Sample.bar = tar
|
||||||
|
|
||||||
|
s = Sample()
|
||||||
|
s.foo()
|
||||||
|
s.bar()
|
||||||
|
|
||||||
|
Sample.x = 100
|
||||||
|
print(Sample.x)
|
12
python-temel/method.overload.py~
Normal file
12
python-temel/method.overload.py~
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
class Sample:
|
||||||
|
def foo(self):
|
||||||
|
print('foo')
|
||||||
|
|
||||||
|
def tar(self):
|
||||||
|
print('bar')
|
||||||
|
|
||||||
|
Sample.bar = tar
|
||||||
|
|
||||||
|
s = Sample()
|
||||||
|
s.foo()
|
||||||
|
s.bar()
|
Loading…
Reference in New Issue
Block a user