abstract classes and interfaces

Steven Schveighoffer schveiguy at gmail.com
Mon Sep 27 16:20:59 UTC 2021


On 9/27/21 12:11 PM, kyle wrote:
> I'm attempting Markdown for the first time so forgive me if that doesn't 
> go well. Consider the following:
> 
> ```d
> interface A
> {
>      bool broken();
> }
> 
> abstract class B : A
> {
> 
> }
> 
> class C : B
> {
> 
> }
> 
> void main()
> {
>      import std.stdio;
>      C test = new C();
>      writeln(test);
> }
> 
> ```
> 
> DMD compiles this providing no notice that either B or C do not 
> implement interface A. Is this how things are supposed to work? Thanks.

That's a regression. In 2.092.1, it reports:

```
onlineapp.d(11): Error: class `onlineapp.C` interface function `bool 
broken()` is not implemented
onlineapp.d(11): Error: class `onlineapp.C` interface function `bool 
broken()` is not implemented
```

As of 2.093, it no longer errors.

-Steve


More information about the Digitalmars-d-learn mailing list