The inheritance of attributes using __init__
When writing the __init__ function for a class in python, you should always call the __init__ function of its superclass. We can use this to pass the relevant attributes directly to the superclass, so your code would look like this: class Person(object): def __init__(self, name, phone): self.name = name self.phone = phone class Teenager(Person): def … Read more