unimplemented abstract function compiles.
Jacob Carlborg
doob at me.com
Mon Aug 13 19:04:48 UTC 2018
On 2018-08-12 19:29, Eric wrote:
> I thought it would work the same way as an interface (which must be
> implemented by the direct sub class, otherwise compile error).
> But apparently it's possible to implement an abstract function anywhere
> in the class hierarchy. That makes it, in this case, impossible to check
> during compile time.
It will be checked during compile time if the class is referenced during
compile time. In your example it's not.
The thing is that a library can provide an abstract class which is then
subclassed and completely implemented by the user of the library. In
that case you don't want an compile error when you're compiling the
library but now using the class. One can argue that an abstract class
always should be marked with "abstract" but that's not currently how the
language is working.
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list