Jeremie Pelletier wrote:
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

What's the point of marking fun() abstract if it has an implementation, I thought the compiler disallowed that.

It may offer incomplete functionality that is to be reused and enhanced by descendants.

Andrei

Reply via email to