Inheritance Example in Python

preview_player
Показать описание
In object-oriented programming, inheritance is the procedure in which one class inherits the attributes and methods of another class. The class whose properties and methods are inherited is known as the Parent class. And the class that inherits the properties from the parent class is the Child class.

In this lesson, we will learn the concept of inheritance through an example coded in python.

Here is the code used in this example:

class Laptop:
def parts(self):
print('Keyboard, Display, Motherboard')

my_laptop = Laptop()

class Desktop(Laptop):
def weight(self):
print('Desktops are heavy-weight')

my_desktop = Desktop()
Рекомендации по теме
Комментарии
Автор

sir you uploaded a video for this playlist after 3 months ! please sir can you upload a little quicker ?

shahbajhossein
Автор

would you please teach (combine heterogeneous models with different class into stacked ensemble) for MULTI CLASS datasets in (matlab)?

mohamadjvn
Автор

Sir can you do traffic light colour detection using CNN ?

RunningLate
welcome to shbcf.ru