Total Page Preview:   000000000352

What is multilevel inheritance in oops in English and Hindi

 

 

Multilevel inheritance in oops in English:

Multilevel inheritance is a type of inheritance in object-oriented programming where a derived class is inherited from another derived class. In other words, a class can inherit properties and behaviors from a base class, which in turn can itself be derived from another base class.

 

In C#, the derived class is declared using the "class" keyword followed by the derived class name and the base class name in parentheses. The derived class can have its own properties and methods, and it can also inherit properties and methods from the base class.
Here's an example of multilevel inheritance in C#:

In this example, the GermanShepherd class is derived from the Dog class, which in turn is derived from the Animal class. The GermanShepherd class has its own method Guard(), but it also has access to the Eat() and Bark() methods of the Animal and Dog classes, respectively, which it inherits through multilevel inheritance. The Main method creates a GermanShepherd object and calls all three methods.

 

Multiulevel inheritance in oops in Hindi:

Multilevel inheritance ek aisi inheritance hai jisme ek derived class dusre derived class se inherit hoti hai. Matlab, ek class base class se property aur behaviour inherit karti hai, jo ki khud dusre base class se inherit hoti hai.

 

C# mein, derived class "class" keyword ke saath declare ki jaati hai, jisme derived class naam aur base class naam ko parenthesis mein likha jaata hai. Derived class apne apne properties aur methods rakh sakti hai, aur yeh base class se bhi property aur methods inherit kar sakti hai.
Yahan ek example hai multilevel inheritance ka C# mein:
Is example mein, GermanShepherd class Dog class se inherit hoti hai, jo khud Animal class se inherit hoti hai. GermanShepherd class ka apna Guard() method hota hai, lekin yeh Animal class ka Eat() method aur Dog class ka Bark() method bhi inherit karti hai, jo ki multilevel inheritance ke dwara hota hai. Main method GermanShepherd object ko create karta hai aur teeno methods ko call karta 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 : https://www.linkedin.com



Comments


                           
                           

                           

                           

Facebook User: