面向对象的三大特性: 继承 多态 封装
class Animal: def __init__(self,name,sex,age): self.name = name self.sex = sex self.age = age class Person: def __init__(self,name,sex,age): self.name = name self.sex = sex self.age = age class Cat: def __init__(self,name,sex,age): self.name = name self.sex = sex self.age = age class Dog: def __init__(self,name,sex,age): self.name = name self.sex = sex self.age = age p1 = Person('alex','laddyboy',1000) class Animal: breath = '呼吸' def __init__(self, name, sex, age): self.name = name self.sex = sex self.age = age def eat(self): print(self) print('动物都需要进食....') class Person(Animal): # 括号里面的 父类,基类