method returning child, doesn't overrides declared method returning parent

Steven Schveighoffer schveiguy at yahoo.com
Tue Aug 30 10:19:47 PDT 2011


On Tue, 30 Aug 2011 13:16:58 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On Tue, 30 Aug 2011 13:06:02 -0400, Timon Gehr <timon.gehr at gmx.ch> wrote:
>
>> I don't think that you can change a widely used interface into an  
>> abstract class and not introduce annoyances much larger than override  
>> is capable of creating.
>
> interface I
> {
>     int foo();
>     void bar();
> }
>
> ->
>
> interface _I
> {
>     int foo();
>     void bar();
> }
>
> abstract class I : _I
> {
>     int foo() { return 0; }
> }

That was kind of weird, I guess I should have done:

interface I
{
     int foo();
     void bar();
}

->

abstract class I
{
     int foo() { return 0; }
     void bar();
}

-Steve


More information about the Digitalmars-d mailing list