企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
#### 继承 ``` 1. 支持多继承 2. 要确定一个类是否是另一个类的子类,可使用内置方法issubclass ``` ``` class Person: name = "张三" def setName(self, name): self.name = name def getName(self): return self.name class Student(Person): def sing(self): return "sing" class Teacher(Person): def dance(self): return "dance" class Man(Teacher, Student): pass student = Student() student.setName("aaaaa") print(student.getName()) print(student.sing()) teacher = Teacher() teacher.setName("aaaaa") print(teacher.getName()) print(teacher.dance()) man = Man() print(man.dance()) print(man.sing()) print(man.getName()) ```