C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
iOS
Java
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
2
Reply
Why multiple Inheritance not work in C sharp?
Pradeep
16y
11.6k
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
Multiple inheritance is not supported in C# through classes becauseClass P1{public void func1(){.....;}}Class P2{public void func1(){....;}}Class P3:P1,P2{static void Main(){P3 obj=new P3();P3.func1();//Here runtime gets confused whether to call func1() of ClassP1 orP2; Ambuguity}}Hence Multiple inheritance is possible using interfaces
Chetnaa Desai
10y
0
When we use the Multiple inherutance we use more than one class. Lets one condition class A and class B are base classes and class c is is multiple inherting it.And where class c is inheriting a function .It may be possible that this function with same name and same signature can present in both class A and Class B . That time how the compiler will know that which function it should take wherether from class A or class B.So Multiple inheritance show's an error.
Sapna Malik
16y
0
What is the difference between const and static read-only?
What is a satellite assembly?
Message