Andrei Alexandrescu wrote:
Good point! Now define Unfinalize that opens the final methods of a class for method overriding.

class A
{
    final int foo(string) { ... }
}

class UnfinalizeA : A
{
    int foo(string a) { return super.foo(a); }
}

DMD rightly doesn't allow this:
---
test.d(8): Error: function test.UnfinalizeA.foo cannot override final function test.A.foo
---

There's a workaround though:
---
class UnfinalizeA : A
{
    int foo_(string a) { return super.foo(a); }
    alias foo_ foo;
}
---

Reply via email to