But you can use interfaces or a combination of I agree with you(if i understood about what you are talking :) )this is no need of such specific naming conventions. interface pet However, it is supported in case of an interface because there is no ambiguity. I thought lets first write about the logic behind not supporting MI in .NET using classes. Multiple inheritance is form of inheritance where two or more classes are inherited by the derived class So why doesnt C# or .NET support MI. For ex. In ABSTRACT class,we can't extends multiple abstract classes at a time. but In INTERFACE, we can implements multiple interfaces at time. Therefore , interfaces are used to achieve multiple inheritance in java. Abstract classes contains Abstract as well as Concrete (Non-abstract) methods. Why C# doesnt support multiple inheritance ? Thus in java a class can not extend more than one class simultaneously. Multiple inheritance is not supported by Java using classes, handling the complexity that causes due to multiple inheritances is very complex. class MyBase. Java does not support multiple Inheritance. -" One reason why the Java programming language does not permit you to extend more than one class is to Inheriting from Abstract Classes Inheriting from abstract classes can alleviate ( some of ) the problems of multiple inheritance. So why doesnt C# or .NET support MI. The overridden method of class B or the overridden method of class C. This is the ambiguity and this problem is simply known as the diamond problem in Java. Thats why Java does not support multiple inheritance in Java. In ABSTRACT class,we can't extends multiple abstract classes at a time. Since the methods were not provided in ancestor classes, they are not inherited in descendant classes, alleviating some of the storage and resolution problems. Now java compiler cannot decide, which display method it should inherit. Why multiple inheritance is used in interface? The reason behind this is to prevent ambiguity. Consider a case where class B extends class A and Class C and both class A and C have the same method display (). Always the root object i.e object of object class hast to be created only once. It is because its implementation is provided by the implementation class. Explanation: The Java language does not support pointers; some of the major reasons are listed below: One of the major factors of not using pointers in Java is security concerns. The reason behind this is to prevent ambiguity. Consider a case where class B extends class A and Class C and both class A and C have the same method display (). Now java compiler cannot decide, which display method it should inherit. To prevent such situation, multiple inheritances is not allowed in java. public override void Test() Debug.WriteLine("SeconedChild"); //Now Suppos that c# support multiple inheritance class AnotherChild: FirstChild, SeconedChild //now some where in your program //you write some thing Providing the required methods can satisfy the We can have concrete methods in abstract class, we have to provide definitions to concrete methods. but Multiple inheritance is also highly discouraged in languages where it is supported (C++ etc.). To prevent such situation, multiple inheritances is not allowed in java. Because of above mentioned reasons multiple inheritance would not be supported by java. This is not allowed because you can do more than this with abstract classes. It wouldn't make sense to allow multiple inheritance, provided you onl So if you use multiple inheritance in abstract class A having method a with one definition and abstract Class B having method a with another definition and Class c inherits A and B then while { But can you explain why multiple inheritance of classes in not supported in C#? Multiple inheritance causes problems, if one or more of the parent classes defines members with same identifier. You would have to decide which parent to use to handle each method call, and the operation of class can be then very different than intended. "Good" classes usually maps to some phenomenom or object, and very few things are at the same time based on two different things.

Because of multiple inheritance there is chance of the root object getting created more than once. 1. the C++ allows you to inherit from more than one class C# does not support multiple inheritance, because they reasoned that adding multiple inheritance added too much complexity to C# while providing too little benefit. This is because abstract classes are still classes, and inheritance is different than implementing an interface. Please see the differences betwee In C#, the classes are only allowed to inherit from a single parent class, which is called single inheritance. It is simpler to only use abstract classes for things you can't do with an interface, in which case you wouldn't be Usually when people wish to do multiple inheritance (is-a), a "has-a" relation is needed, meaning that a class contains some objects.

Explanation: The abstract classes can always be used in multilevel inheritance. It wouldn't make sense to allow multiple inheritance, provided you only used an abstract class when you could have used an interface. public abstract void Test(); class FirstChild: MyBase. As we have explained in the inheritance chapter, multiple inheritance is not supported in the case of class because of ambiguity. Which of the following is not supported by java? 2. Multiple inheritance is form of inheritance where two or more classes are inherited by the derived class. The problem occurs if both base classes (class A and class B) have the same methods with the same signature. The multiple inheritance also creates problems in constructor chaining. public ab As class D extends both class B and class C so if D wants to use or call the same method then which method would be called. In INTERFACE, we can implements multiple interfaces at time. Therefor It creates problems during various operations like casting, constructor chaining, etc, and the above all reason is that there are very few scenarios on which we actually need multiple inheritances, so better to omit it for keeping things public override void Test() Debug.WriteLine("First Child"); class SeconedChild: MyBase. The compiler cant determine which class method to be called. It creates ambiguity for the compiler.