python——类——封装 继承 多态

概述 类由一系列函数对象组成,在类中,函数对象称为方法,方法的第一个参数必须为self,表示当前实例对象 可把类理解为一个dict,key为方法名(string类型),value为方法 class Animal(object): def __init__(self, age, color): self.age = age self.color = color
相关文章
相关标签/搜索