Get startedGet started for free

Understanding inheritance

Inheritance is a powerful tool of object-oriented languages that allows you to customize the functionality of existing classes without having to re-implement methods from scratch.

In this exercise, you'll check your understanding of inheritance. The questions refer to the following two classes:

class Counter:
    def __init__(self, count):
       self.count = count

    def add_counts(self, n):
       self.count += n

class Indexer(Counter):
    pass

This exercise is part of the course

Introduction to Object-Oriented Programming in Python

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise