0

The C# 8 proposal for default interface methods shows the following example...

using static System.Console;

interface IA
{
    void M() 
    {
        WriteLine("IA.M"); 
    }
}
interface IB : IA
{
    override void IA.M()    // The modifier 'override' is not valid for this item
    {
        WriteLine("IB.M");
    }
}
interface IC : IA
{
    override void IA.M()    // The modifier 'override' is not valid for this item
    { 
        WriteLine("IC.M"); 
    }
}

class D : IA, IB, IC
{
    void IA.M() 
    { 
        base(IB).M();       // Use of keyword 'base' is not valid in this context
    }
}

... but it doesn't compile in the latest version of Visual Studio 2019 (v16.4.5).

What happened to this feature? Is it simply not implemented yet, or was a decision made to abandon it?

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
Verax
  • 2,409
  • 5
  • 27
  • 42
  • What specific error do you receive when compiling? – Joe Sewell Mar 02 '20 at 18:04
  • @JoeSewell I updated the question with the compiler errors. – Verax Mar 02 '20 at 18:07
  • At the start of the page you linked to, the status is only "Proposed", and the prototype is "In Progress". The sole contributor appears to be busy on other things at the moment. – Andrew Morton Mar 02 '20 at 18:44
  • FYI: It appears the implementation for this ability this is being tracked at https://github.com/dotnet/csharplang/issues/2337 – Verax Mar 04 '20 at 04:45
  • Also, just dropping the `override` keyword from the example will compile and work. Only the `base` syntax is not yet implemented. – Verax Mar 05 '20 at 04:14

0 Answers0