17. Inheritance [Python 3 Programming Tutorials]

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 What is Inheritance?
1:44 Implement Inheritance in python
2:33 Derive a class from another class
4:42 Create objects of class
8:24 Benefits of inheritance (code reuse, extensibility, readability )

Next Video:

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

The way of your explanation is amazing with simple examples

rahil
Автор

After learning basic python, when I am seeing your playlist of python. It actually made sense of learning python. I am loving it. 💓

subhajitmandal
Автор

Brilliant !!
Super Explaining of each and every logic and functions :)

lalitvyas
Автор

thanks for everything you are teaching.

My prayers for you :)

slayer_dan
Автор

sir please also upload an exercise for us for practice purposes at the end of the tutorial, your learning technique is absolute sir!

brijkishorsoni
Автор

I have seen many OOP videos in Spanish (my mother tongue) without understanding anything with them and I am still amazed to understand better this subject with your videos haha.
I know this has no sense, but I really want to say it, your VIDEOS ARE REALLY WONDERFUL.
Thank you

kalef.l
Автор

You have amazing ability to discribe things smoothly and neatly...awsome dude..

jiyabyju
Автор

Thank you sir!! i like your way of teaching. Your examples are super sir

dynamic_dharsan_xor
Автор

Is it okay that we don't define the __init__ method in the base class?

RM-lbxw
Автор

Hi Quick Question. why are we using self in __init__? Would be helpful if you could explain. thanks in advance.

prithviraj
Автор

The exercise you have given is sometimes out of scope of the current video in question. Certain syntax/functions are taught in the future videos., The exercise given by you past videos incurs elements from future videos.

TopPrimeTV
Автор

Sir you say 1-16 is necessary for data analysis... When we need to learn 17-end

alnoneatall
Автор

You can use your car for driving, illegal substances, moonlighting 😆 I love your humour

laurablue
Автор

Doubt:
I defined a class with __init__ defined. Then created a subclass and tried to access the parameters from the class. I am getting an error - AttributeError: 'smalldogs' object has no attribute 'breed'
Can you please help
Code below

class Dog: #defining a class

def __init__(self, dogBreed, dogColor, comfortableseason): #init function to initialize the object with property breed and color
#the function will take dogbreed and dogcolor as arguements

self.breed = dogBreed
self.Color = dogColor
self.season = comfortableseason

def env(self, a): #defing a method/function in a class

if self.breed == 'Indian':
print("street")
print(self.season)

print(a)

else:
print("home")
print(self.season)
print(a)


Kusto = Dog("Lab+stray", "Brown and White", "Cool") #defining objects
Patchy = Dog('Indian', "Black and white", "Summer")

print(Kusto.breed)
Kusto.env("aloo khalo")

class smalldogs (Dog):
def __init__(self, dogsize, doghairstyle):
self.size = dogsize
self.hairstyle = doghairstyle

def specificinfo(self):
print("Love to stay home")

class largedogs (Dog):
def __init__(self, dogsize, dogjump):
self.size = dogsize
self.jump = dogjump

def specificinfo(self):
print("Love to stay wander")

foxy = smalldogs("small", "normal")
foxy.env("jump")

kartikayekishore
Автор

#Here is my dummy question?

Class MotorCycle(Vehicle):
def __init__(self):
print("I'm motorcycle")
self.wheel = 4
self.has_roof = True


#--> WHY INSTEAD OF
#DEF __INIT__(SELF, WHEEL, HAS_ROOF):
# PRINT("I'M MOTORCYCLE")
#--->SELF.WHEEL = WHEEL
#--> SELF.HAS_ROOF = HAS_ROOF
LET'S SEE IF I CAN GUESS, Correct answer is in the previous method
# you already initialized the variables. Otherwise, with (self, wheel, has_roof) I have to initialize them later / or assign a value.

Nearco