An interface is just a base class that has no data elements and defines only public abstract methods. For example, this will be an interface in C ++:
class IFrobbable { public: virtual void Frob() = 0; }
Therefore, when MI is available as a function of the language, you can "implement" the interfaces by simply calling them (again, C ++):
class Widget : public IFrobbable, public IBrappable {
Multiple inheritance in the general case raises many questions and problems that do not necessarily have one answer or even a good one for your specific definition of “good” (a scary diamond , anyone?). The implementation of several interfaces will cost most of these problems precisely because the concept of "inheriting" an interface is a very limited particular case of inheriting a full-blown class.
And it was here that “forced us to add the concept of interfaces”: you cannot do a lot of OO design if you are limited to a single inheritance, for example, there are serious problems with the inability to reuse code when reusing code, in fact one of the most common arguments for OO. You have to do something else, and the next step is to add multiple inheritance, but only for classes that satisfy the limitations of the interface.
So, I interpret Krzysztof's quote as
Multiple inheritance in the general case is a very complex problem that we could not handle satisfactorily, given the real life limitations on .NET development. However, interface inheritance is so much easier to solve and of paramount importance in OOP, so we did it but, of course, interfaces also have their own set of problems, mainly regarding how BCL is structured.
Jon Jan 23 '13 at 15:06 2013-01-23 15:06
source share