摘要: 1、来自python官网的解释: super([type[, object-or-type]]) Return a proxy object that delegates method calls to a parent or sibling class of type. This is usefu 阅读全文
posted @ 2016-12-04 06:10 小Y看世界 阅读(328) 评论(0) 推荐(0) 编辑
摘要: super() 的入门使用 在类的继承中,如果重定义某个方法,该方法会覆盖父类的同名方法,但有时,我们希望能同时实现父类的功能,这时,我们就需要调用父类的方法了,可通过使用 super 来实现,比如: 在上面,Animal 是父类,Dog 是子类,我们在 Dog 类重定义了 greet 方法,为了能 阅读全文
posted @ 2016-12-04 05:42 小Y看世界 阅读(139) 评论(0) 推荐(0) 编辑