Python 101 : Parent and children classes - __init__(), super() -

 For our example, we define a class called "Member":

We subclass our class "Member" as below:

Defining __init__() in our subclass will cause it to replace __init__() of the parent class, which will not be called automatically. We called it "manually" in our code, above.


If we don't define an __init__() method in our subclass the __init__() of our parent class will be called automatically when we create an instance of the subclass.


Leave as a comment: