文章分类 -  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 阅读全文
posted @ 2021-07-26 15:50 游走在六环 阅读(38) 评论(0) 推荐(0)
摘要:# property 私有化 class Student: def __init__(self, name, age, score): self.name = name self.age = age self.__score = score def __str__(self): return 'na 阅读全文
posted @ 2021-07-26 10:58 游走在六环 阅读(32) 评论(0) 推荐(0)
摘要:# 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( 阅读全文
posted @ 2021-07-22 10:18 游走在六环 阅读(38) 评论(0) 推荐(0)