Subclasses (Inheritance)


#1

Hello, I was doing exercice 13 in the Introduction to Objects unit in Python. I was creating a subclass of Employee called Part Time Employee but I noticed that i could pass the exercice without defining init. So my question, in Python classes, when a subclass inherits from a class, does it also inherit the init definition?
Here is my code:

class Employee(object):
    """Models real-life employees!"""
    def __init__(self, employee_name):
        self.employee_name = employee_name

    def calculate_wage(self, hours):
        self.hours = hours
        return hours * 20.00

# Add your code below!
class PartTimeEmployee (Employee):
    
    def calculate_wage (self, hours):
        self.hours = hours
        return hours * 12.00

#2

Yes! It automatically inherits all attributes of the superclass, unless you specify otherwise.