摘要: 多态:多态指的是一类事物有多种形态 多态性: class Animal: def run(self): raise AtrributeError("子类必须实现这种方法") class Person(Animal): pass p = Person() p.run() 通过父类主动抛出一个异常,告诉 阅读全文
posted @ 2019-12-21 14:20 老方学编程 阅读(1611) 评论(0) 推荐(0)
摘要: class Father(): name = "老方" sex = "男" def __init__(sef): print("Father构造函数运行") def speak_english(self): print("father说英语") def __juehuo(self): print(" 阅读全文
posted @ 2019-12-21 13:37 老方学编程 阅读(585) 评论(0) 推荐(0)