The ability to inherit from more than one class is called multiple inheritance. C# prohibits multiple inheritance, but it does provide an alternative mechanism. Why is multiple inheritance prohibited, and what is the alternative that is provided?
What will be an ideal response?
Multiple inheritance is a difficult concept, and programmers encounter many problems when they use it. For example, variables and methods in the parent classes may have identical names, creating a conflict when the child class uses one of the names. Additionally, a child class constructor must call its parent class constructor. When two or more parents exist, this becomes a more complicated task: To which class should base refer when a child class has multiple parents?
For all these reasons, multiple inheritance is prohibited in C#. However, C# does provide an alternative to multiple inheritance, known as an interface. Much like an abstract class, an interface is a collection of methods (and perhaps other members) that can be used by any class as long as the class provides a definition to override the interface's abstract definitions.
You might also like to view...
What is the difference between static and dynamic data structures?
What will be an ideal response?
When using packet switching, packets are always sent over the same route.
Answer the following statement true (T) or false (F)