Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>An interface is simply a base class that has no data members and only defines <code>public abstract</code> methods. For example, this would be an interface in C++:</p> <pre><code>class IFrobbable { public: virtual void Frob() = 0; } </code></pre> <p>Therefore when MI is available as a language feature you can "implement" interfaces by simply deriving from them (again, C++):</p> <pre><code>class Widget : public IFrobbable, public IBrappable { // ... } </code></pre> <p>Multiple inheritance <em>in the general case</em> gives rise to many questions and problems that don't necessarily have a single answer, or even a good one for your particular definition of "good" (<a href="http://www.parashift.com/c++-faq/mi-diamond.html">dreaded diamond</a>, anyone?). Multiple interface implementation sidesteps most of these problems exactly because the concept of "inheriting" an interface is a very constrained special case of inheriting a full-blown class.</p> <p>And this is where "forced us to add the concept of interfaces" comes in: you cannot do much OO design when constrained to single inheritance only, for example there are serious issues with not being able to reuse code when code reuse is in fact one of the most common arguments for OO. You have to do something more, and the next step is adding multiple inheritance but only for classes that satisfy the constraints of an interface.</p> <p>So, I interpret Krzysztof's quote as saying</p> <blockquote> <p>Multiple inheritance in the general case is a very thorny problem that we could not tackle in a satisfactory manner given real-life constraints on the development of .NET. However, interface inheritance is both much simpler to tackle and of supreme importance in OOP, so we did put that in. But of course interfaces also come with their own set of problems, mainly regarding how the BCL is structured.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload