Nick Sabalausky wrote:
"Andrei Alexandrescu" <[email protected]> wrote in message news:[email protected]...
Ary Borenszweig wrote:
Umm... so it defines a body that will never be used because that class can't be instantiated and the method must be redefined by subclasses? Isn't that the same as "doesn't provide a body"?
import std.stdio;

class A {
    abstract void fun() { writeln("wyda"); }
}


class B : A {
    void fun() { A.fun(); }
}

unittest {
    A a = new B;
    a.fun();
    a.A.fun();
}


Not a rhetorical or a loaded question: Has that sort of thing ever been useful?

I was wondering the same. It's also very bug prone because when overriding the function you must remember to invoke the super method, a thing you can forget.

Reply via email to