Is multiple inheritance supported in C#?
Loading
Is multiple inheritance supported in C#?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajeev KumarPosted Mar 14, 2023, 9:54 AM
C# does not support multiple inheritance. In C#, the classes are only allowed to inherit from a single parent class, which is called single inheritance. But in C# we can achieve it by Interface.
Brahma Prakash ShuklaPosted Oct 19, 2022, 8:40 AM
C# does not support multiple class inheritance. To overcome this problem we use interfaces to achieve multiple class inheritance.
Rajanikant HawaldarPosted Sep 17, 2022, 10:57 AM
C# does not support mutliple inheritance, Using interface we can achieve it.
Satya KarkiPosted Sep 17, 2022, 5:56 AM
Hi,
check below article for more clarification.
http://net-informations.com/faq/general/inheritance.htm
But C# does not support multiple class inheritance. To overcome this problem, we use interfaces to achieve multiple class inheritance.
Rijwan AnsariPosted Sep 17, 2022, 5:30 AM
It is not supported, and actually you don't need it. You can fix it with Interfaces easily.
sudeep HPosted Sep 15, 2022, 12:05 PM
Multiple Inheritance isn’t supported in C#. To implement multiple inheritances, use Interfaces.
Vishal YelvePosted Sep 15, 2022, 5:25 AM
Hi Dpk,
Multiple Inheritance isn’t supported in C#. To implement multiple inheritances, use Interfaces.
The reason behind this is:
calculate()in two base classes and both are doing different calculations. What happened if the user callscalculate()in the child class? Which method will work?InheritancewithInterfaceprovides the same job of multiple inheritances.Also, Please refer to below links
https://www.c-sharpcorner.com/blogs/multiple-inheritance-in-c-sharp-using-interfaces1
https://www.dotnetforall.com/why-c-sharp-doesnt-support-multiple-inheritance/
Amit MohantyPosted Sep 15, 2022, 5:05 AM
C# does not support multiple inheritance. In C#, the classes are only allowed to inherit from a single parent class, which is called single inheritance. But multiple Inheritance can be achieved in C# using Interfaces.
For more details check links
https://www.c-sharpcorner.com/blogs/multiple-inheritance-in-c-sharp-using-interfaces1
https://dotnettutorials.net/lesson/multiple-inheritance-csharp/
Jignesh KumarPosted Sep 15, 2022, 4:52 AM
Hi,
By Default C# doesn't support multiple inheritance but we can achieve vai Interface, You can refer this article which will help you to understand step by step,
https://www.c-sharpcorner.com/UploadFile/0c1bb2/types-of-inheritance-in-C-Sharp/
Uday DodiyaPosted Sep 15, 2022, 4:36 AM
Multiple Inheritance isn’t supported in C#. To implement multiple inheritances, use Interfaces.
Refer Following For More
https://www.geeksforgeeks.org/c-sharp-multiple-inheritance-using-interfaces/