- 博客(5)
- 收藏
- 关注
原创 自动发牌器
# 姓名:东电小z# 开发时间:2021/4/25 15:33class Card: # 类属性 shuzi = ['A', '2', '3', '4', '5', '6', '7,', '8', '9', '10', 'J', 'Q', 'K'] biaozhi = ['♠', '♥', '♦', '♣'] # 初始方法 def __init__(self): self.cards = [] # 生成牌 def shengc.
2021-04-25 21:33:41
329
原创 继承
# 姓名:东电小z# 开发时间:2021/4/23 16:11'''父类方法不能满足子类,在子类中可以定义一个同名方法进行重写如果父类和子类中有同名方法,默认搜索原则为:先子类,若有则不再父类子类可以用super().eat()去调用父类的方法 '''class Person(): def __init__(self, name, age): self.name = name self.age = age def run(self):.
2021-04-23 16:29:54
53
原创 私有化之property
# 姓名:东电小张# 开发时间:2021/4/21 22:54class Student(): def __init__(self, name, age, score): self.__name = name self.__age = age self.__score = score @property def age(self): return self.__age @age.setter .
2021-04-23 12:09:56
54
原创 继承中的has a
# 姓名:东电小张# 开发时间:2021/4/23 9:37class Computer(): def __init__(self, brand, price): self.brand = brand self.price = price def __str__(self): return self.brand + str(self.price)class Book(): def __init__(self, bname.
2021-04-23 11:57:44
73
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人