Python 3 Tutorial: 21 – Inheritance

Python

Video is ready, Click Here to View ×


This tutorial introduces inheritance, a crucial part of classes. It also briefly touches upon overriding methods, but I will get more in depth with that in a later tutorial

26 thoughts on “Python 3 Tutorial: 21 – Inheritance

  1. When you extend the Person class into the Military class, aren't you already inheriting the constructor from the Person class? Why do you have to call out the Person.__init__(self, name, age)?

    Thanks

  2. Really great video, I am planning to go through all your videos.
    I have one concern here related to inbuilt method _DEL_. It's declaration takes input parameter as self, but when calling neither using object or class name. why is it designed this way?

  3. does python 2.7.3 work different to python 3 for this example? Because when i type: m1 = Military('Dan', 40, 'General') in python shell, i get an error which says Person.__init__(self, name, age) , TypeError: _init_() takes exactly 3 arguments (4 given)
    I have written the exact same code as the one you have in the video!
    Thanks

  4. Your videos saved my life! Can you do the overriding with non-special methods as well? I was just wondering weather you could override because you used __xx__ methods or it occurs whenever you make a method whose name is same as the parent class.

Leave a Reply

Your email address will not be published. Required fields are marked *