类与对象
1.python多态
定义时的类型和运行时的类型不一样,则称为多态。pyhton语言崇尚"鸭子类型"多态,即调用实例方法时不检查类型,只要方法存在,参数正确,就可以调用,它并不要求严格的继承体系,一个对象只要“看起来像鸭子,走起路来像鸭子”,那它就可以被看做是鸭子。
# class Cat(object):
# def info(self):
# print('i am cat')
#
# class Dog(object):
# def info(self):
# print('i am dog')
#
# class Duck(object):
# def info(self):
# print('i am duck')
#
#