class TheThing(object):
""" __init__ 函數 用於創建內部變量 """
def __init__(self):
self.number = 0
""" self 類似於C++中的this """
def some_fuction(self):
print("I got called.")
def add_me_up(self, more):
self.number += more
return self.number
# two different things
a = TheThing()
b = TheThing()
a.some_fuction()
b.some_fuction()
print(a.add_me_up(20))
print(b.add_me_up(20))
print(b.add_me_up(30))
print(a.number)
print(b.number)