Class Sample def foo

This commit is contained in:
Mert Gör 🇹🇷 2023-06-22 23:18:10 +03:00
parent 30af94a979
commit 3cd256fc5f
No known key found for this signature in database
GPG Key ID: 2100A876D55B39B9

View File

@ -0,0 +1,14 @@
class Sample:
def __init__(self, a, b):
self.a = a
self.b = b
def foo(k):
print(k.a, k.b) # 10 20
k.a = 100
k.b = 200
s = Sample(10, 20)
print(s.a, s.b) # 10 20
foo(s)
print(s.a, s.b) # 100 200