Should certain abstract classes be instantiable?
Nick Sabalausky
a at a.a
Sun Oct 4 23:24:13 PDT 2009
"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message
news:ha8beq$2tn9$1 at digitalmars.com...
> 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?
More information about the Digitalmars-d
mailing list