Should certain abstract classes be instantiable?
Lionello Lunesu
lio at lunesu.remove.com
Fri Oct 2 10:05:07 PDT 2009
On 2-10-2009 8:32, Lionello Lunesu wrote:
> On 2-10-2009 4:30, Andrei Alexandrescu wrote:
>> Consider:
>>
>> class A {
>> abstract void fun() {}
>> }
>>
>> The class defines a function that is at the same time abstract (so it
>> requires overriding in derivees) and has implementation.
>>
>> Currently the compiler disallows creation of objects of type A, although
>> technically that is feasible given that A defines the abstract method.
>>
>> Should A be instantiable? What designs would that help or hinder?
>>
>>
>> Andrei
>
> If it were instantiable, what would be the difference between "abstract"
> and "virtual"?
OK, so I reread your post and yes, "it requires overriding in derivees."
Derived classes would still be allowed to do super.fun(), calling the
'abstract' class's implementation. It's like NVI, only worse?
L.
More information about the Digitalmars-d
mailing list