Discuss / Python / 笔记

笔记

Topic source

1、和Java不同,Python一个子类可以继承多个父类,在定义类的时候说明,格式是:

class son (father1,father2,father3):

优先级从左往右。

2、MixIn,可以混合继承父类,没看出和上面说的的多重继承有啥不同。

语法上是: class son (father1,father2MixIn,father3MixIn):

MixIn只是用来做说明。


  • 1

Reply