On 5/16/22 22:08, matheus wrote:

> interface Shape {
>    void draw();
>    void draw(float scale);
> }

Interfaces can have 'final' functions:

interface Shape {
  void draw(float scale);

  final void draw() {
    draw(1);
  }
}

Obviously, for that to work, now Circle.draw() etc. required to respond to a 'scale' parameter.

> In D there would be a better way to do such thing?

Reminding that class hierarchies can be deeper as well:

interface A {                        }
class B : A {          void foo() {} }
class C : B { override void foo() {} }

Ali

Reply via email to