理解继承
继承是面向对象语言中的强大工具,允许您在不从头重写方法的情况下,自定义现有类的功能。
在此练习中,您将检查自己对继承的理解。以下问题基于下面两个类:
class Counter:
def __init__(self, count):
self.count = count
def add_counts(self, n):
self.count += n
class Indexer(Counter):
pass
本练习是课程的一部分
