Python Tutorial - 18. Inheritance

preview_player
Показать описание

In today’s python tutorial we will discuss “inheritance”. The video will give insights regarding what is an inheritance, how to implement inheritance in python, how to derive a class from another class, how to create objects of class and the benefits of inheritance.

Topics that are covered in this Python Video:
0:00 Introduction
0:13 what is Inheritance
2:05 Implement Inheritance in python
3:01 derive a class from another class
5:29 create objects of class
9:50 benefits of inheritance (code reuse, extensibility, readability )

Next Video:

Рекомендации по теме
Комментарии
Автор

Wow, thank you so much!

This is the best I've seen for a beginning introduction to OOP! I am a self-taught programmer, and grasped everything up until this point (and started writing my own programs already). I could not understand classes with the other videos, but thanks to you, I finally got it. Subscribed! :)

Edit: "other videos" as in, other youtubers' videos haha

TheBurningofSolomon
Автор

The first thing I do whenever I start the video is to give it a *Like*. I am afraid of forgetting to give a thumps up for each video of this channel.

ketankulkarni
Автор

you need more views man!!
you are great

ramchandersahu
Автор

Hello sir I have opted for btech IT and I am watching your videos for last 15 days on Python data analyst and I amjust loving it . i request you to upload video on data structures and algorithms please sir

sachinshrestha
Автор

Great tutorial. Just found this. Keep up your good work

Mykelboachie
Автор

Thanks you for all. !!!! it´s the best video that i found about inheritence!... I will follow you !

LuisMan
Автор

thank you for this simple yet effective tutorial.

iheanyionwubiko
Автор

Nice explanation with real-time examples and with general English

prudvinayakgugulothu
Автор

Simplicity is the highlight of this video tysm sir

siddharthupadhyay
Автор

concept clear
very usefull
thank you for giving this video

a.subashsethuraman
Автор

at 5:21 is the perfect example on why you should not copy paste your code. specially if you're a beginner.

BeYakko
Автор

Thanks for the great tutorial so far, i'm almost there (end of the playlist) ;--).

One question, lets say we want to give vehicle its own constructor, e.g. outsource the property wheels. How do we call both constructors properly?

class Vehicle:
def __init__(self, numWheels):
print("I'm vehicle")
self.wheels = numWheels

def general_usage(self):
print("general use: transporation")

class Car(Vehicle):
def __init__(self):
print("I'm car")
self.has_roof = True

def specific_usage(self):
self.general_usage()
print("specific use: commute to work, vacation with family")

class MotorCycle(Vehicle):
def __init__(self):
print("I'm motor cycle")
self.has_roof = False

def specific_usage(self):
self.general_usage()
print("specific use: road trip, racing")

c = Car() # how do we pass numWheels?

looper
Автор

Good


Please add more videos on OOPs, abstract class, abstract method etc.

its_kumar
Автор

sir can you post a video describing why we really need class concept, with an example coded using class and without class

febinjose
Автор

Thank you a lot.Here is my first program.
#In how many days we will change year
import datetime
class Dateremaining:
def __init__(self):

def result(self):
year=datetime.datetime(2018, 1, 1, 0, 0, 0)
self.difference=year-self.ct
return self.difference
Object1=Dateremaining()
print Object1.result()

kostasnikoloutsos
Автор

what is the name of music which is being played at background, is so good

omkarchavan
Автор

why is the self written inside parenthesis provided, i mean what is its role?

kushichittimireddy
Автор

Hi Sir, can you take one tutorial for scripting on Class and inheritance for any real life use case just like how you did Data Analysis using PowerBI. I mean how to understand the use case and then how do we start writing code for that use case which involves class and inheritance in it .

gargisingh
Автор

This also covers polymorphism but self I think is correlated to the instance of the class not the class.

rthu
Автор

How to call the properties wheels and roofs?

Mahesh-mfuw