On Tuesday, 2 June 2015 at 11:07:21 UTC, Liam McSherry wrote:
In the examples you give, you could surround the final methods in a final block. Testing with dmd 2.067.1, the following works:

---
class C
{
    final
    {
        void nonOverrideable()
        {
            "Hello, World!".writeln;
        }
    }

    bool overrideable()
    {
        return true;
    }
}

class D : C
{
    override void nonOverrideable() // Error
    {
        "Goodbye!".writeln;
    }

    override bool overrideable() // No error
    {
        return false;
    }
}
---

To me, at least, it's also more intuitive than "!final:".

For me it looks ugly. But I would prefer final(false) instead of !final.

Reply via email to