Python Multiple Inheritance

Python Multiple Inheritance In Hindi – Inheritance In Hindi

Python

Python Multiple Inheritance In HindiInheritance In Hindi – Inheritance Allows Karta Hai Hame Ki Class Define Karo Uske Bad Ham Inherits Kar Sakte Hai All Methods And Properties Yani Dusri Class Ke |

For Example:- Derived Class Kar Sakta Hai Parent Class Ke Properties Ko |

Read Also :- Python Classes and Objects

Python Multiple Inheritance In Hindi

Inheritance OOP Ka Ek Part Hota Hain And Inheritance Mai Ek Se Jyada Classes Hote Hain |

What Is Inheritance In Hindi

Ek Bar Ek Parent Class Ko Create Karne Ke Bad Ham Parent Class (Base Class ) Ko Ham Derived Class (Sub Class ) Me Istemal kar Sakte Hain And Parent Class Or Derived Class Ke Features To Alag-Alag Honge Hi. Lekin Ham Derived Class Se Parent Class Ke Features Ka Istemal Kar Sakte Hain |

Inheritance In Python in Hindi Ko Understand Karne Ke Liye Upper Diye Image Ka Example Dekhte Hain

Jaise Aap Dekh Sakte Hai Hamne Ek Parent Class (Vehicle) Create Ki Hain Or Vehicle Mai Koi Type Ke Vahical Hote Unke Liye Hamne Derived Class (Car, Bus, Bike ) Alag- Alag Create Ki Or Ab Inhe Derived Class Se Parent Class Ke Features Ka Istemal Kar Sakte Hain.

Read Also :- Python OOPS Concepts

Inheritance Ko 2 Class Dena Jaruri Hota Hain |

  • Base Class 1 (Parent 1): Base class Ko parent class Bhi Kaha Jata Hain.
  • Base Class 2 (Parent 2): Base class Ko parent class Bhi Kaha Jata Hain. Or Ye Base Class 1 Ka Parent Bhi Hota Hain |
  • Multi Derived Class(Child): Derived class Ko sub Ya child class Bhi Kaha Jata Hain| Derived class Ye Base class Ki properties Ya attributes Ko inherit Karta Hai |

Python multiple inheritances. Base Classes Ke Jo Features Hote Hain Wo Inherits Karte Hain MultiDerived Class Ko. multiple inheritances Ka Syntax similar Hota Hai single inheritance Ke.

Syntax:

class Base1:
    pass

class Base2:
    pass

class MultiDerived(Base1, Base2):
    pass

Example Image:

Multiple Inheritance in Python
Multiple Inheritance in Python

Example 1:

class Class1: 
	def m(self): 
		print("In Class1") 
		
class Class2(Class1): 
	def m(self): 
		print("In Class2") 
		
class Class3(Class1, Class2): 
	pass
	
obj = Class3() 
obj.m() 

Output:

In Class1

Yadi Aapne  HTML Full Course  And CSS Full Course Nhi Read Kiya Hai To Aap Vah Bhi Read Kar Sakte Hai |

Types Of Inheritance in Python in Hindi

Python Mai Inheritance 3 Types Ke Hote Hain | Lekin Jo Hamne Abhi Read Kiya Hain Yah Ek Multiple Inheritance Hain |

Abhi Tak Keval Inheritance Or Multiple Inheritance Ko Cover Kiya Hain Lekin Next Post Mai Ham Multilevel Inheritance Ko Cover Karne Wale Hain |

Leave a Reply

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