摘要:
class Student: def __init__(self, name, age): self.name = name self.age = age s1 = Student('s1', 29) s2 = Student('s2', 29) s3 = Student('s3', 26) # s 阅读全文
摘要:
__? 表示是私有,私有得,只能内部才能访问 class Info: city = 'sc' __xx = 'xxx' # __表示私有成员 def __init__(self, name, age): self.name = name self.__age = age def show(self) 阅读全文
摘要:
# __add__ class Info: def __init__(self, number): self.number = number def __add__(self, other): # return self.number + other.number # self.number 表示o 阅读全文