'''''''''面向对象三大特性:封装,继承,多态1.封装: 类中以_或者__的属性,都是私有属性,禁止外部调用.'''class Student(object): def __init__(self,name,age,sex): self.__name = name self.__age = age self.__sex = sex one = Student('wsx',18,'男') print(one._Student__name)print(one._Student__age)pri…
'''''''''一.多态1.Python中多态是指一类事物有多种形态.''' class Animal: def run(self): raise AttributeError('子类必须实现这个方法') #抛出异常 class People(Animal): def run(self): print('人正在走') class Pig(Animal): def run(self): print('pig is walking') class Dog(Animal): def run(self…