Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Interface support multiple inheritance and class doesnt in c# [duplicate]

Possible Duplicates:
Why C# doen't support multiple inheritance
Should C# include multiple inheritance?

i like to what is reason for interface support multiple inheritance and class doesnt support

like image 812
ratty Avatar asked Apr 18 '26 02:04

ratty


1 Answers

I would rather 'negate' your statement.. "interface support multiple inheritance".

Interface is NOT actually inheritance, it is JUST a "contract" of service/behavior that a class abides with.

By implementing an interface a class does NOT inherit anything per se.

And since a class/entity can bind with multiple contracts (behaviours), we can implement multiple interfaces in a class.

like image 147
Manish Basantani Avatar answered Apr 20 '26 20:04

Manish Basantani