Total Page Preview:   000000002121

What is multiple inheritance in English and Hindi


Multiple inheritance in English

In this inheritance, a derived class is created from more than one base class. This inheritance is not supported by .NET Languages like C#, F#, etc., and Java Language.

In the given example, class c inherits the properties and behavior of class B and class A at the same level. So, here A and Class B both are the parent classes for Class C.
In C#, multiple inheritance is not supported, but you can achieve similar functionality using interfaces.
Here's an example of using interfaces to achieve multiple inheritance in C#:
In this example, we have two interfaces, IAnimal and IMammal, that define methods that a Platypus class can implement. The Platypus class implements both interfaces, allowing it to inherit the properties and behaviors of both the IAnimal and IMammal interfaces.
Now, you can create a Platypus object and call its methods:
Here, you can see that the Platypus class can call the Eat method inherited from the IAnimal interface and the Sleep method inherited from the IMammal interface.



Multiple inheritance in Hindi

Multiple inheritance ek object-oriented programming (OOP) concept hai jisme ek class multiple parent classes se properties aur behavior inherit kar sakti hai.Yeh concept inheritance ki hierarchy ko multiple levels tak extend karta hai. Jaise ki single inheritance mein, ek class ek hi base class se inherit kar sakti hai, wahi multiple inheritance mein, ek class multiple base classes se inherit kar sakti hai.
Multiple inheritance C# mein directly support nahi karta hai, lekin aap interfaces ki madad se multiple inheritance ki tarah functionality achieve kar sakte hain.
Yahan ek C# example hai jisme aap interfaces ka upyog karke multiple inheritance ki tarah functionality achieve kar sakte hain:
Is example mein, hum do interfaces IAnimal aur IMammal ka upyog kar rahe hain jo methods define karte hain jo Platypus class implement kar sakti hai. Platypus class dono interfaces ko implement karti hai, jisse ismein IAnimal aur IMammal interfaces ke properties aur behaviors ko inherit karne ki anumati milti hai.
Ab, aap ek Platypus object create kar sakte hain aur uske methods ko call kar sakte hain:
Ismein aap dekh sakte hain ki Platypus class IAnimal interface se inherit kiye gaye Eat method aur IMammal interface se inherit kiye gaye Sleep method ko call kar sakti hai.





Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn :





Facebook User: