Aan de slagGa gratis aan de slag

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

Deze oefening maakt deel uit van de cursus

Introduction to Object-Oriented Programming in Python

Cursus bekijken

Praktische interactieve oefening

Zet theorie om in actie met een van onze interactieve oefeningen.

Begin met trainen