文章分类 - python
python学习笔记
摘要:# is a base class 父类、基类# Exception'''继承: Student,Employee,Doctor > 都属于人类 相同代码 > 代码冗余,可读性不高 将相同代码提取 >Person 类 class Student(Person): pass特点: 1.如果类中不定义_
阅读全文
posted @ 2021-07-26 22:16
游走在六环
摘要:# is a base class 继承关系 父类,基类(统一功能特征,减少代码冗余) # 比如 Exception 类 class Student: def __init__(self, name, age): self.name = name self.age = age def eat(sel
阅读全文
摘要:# property 私有化 class Student: def __init__(self, name, age, score): self.name = name self.age = age self.__score = score def __str__(self): return 'na
阅读全文
摘要:# has a / is a class Computer: def __init__(self, brand, type, color): self.brand = brand self.type = type self.color = color def online(self): print(
阅读全文

浙公网安备 33010602011771号