Missing warning?

Missing warning?


  TMyClass = class abstract (TObject)

     // Lots of methods, but none of them abstract;


  TMyImplementedClass = class(TMyClass)

    // Overrides some of the parent methods and adds new ones



   TFoo: TMyClass;


   TFoo := TMyClass.Create;  *// WHAT!? No Warnings!?*


The XE2 to XE7 documentation states…


states “Note: Delphi allows instantiating a class declared abstract, for backward compatibility, but this feature should not be used anymore.” – which is all dandy, but not issuing a warning for such use, that seems wrong to me.

Interestingly, the XE version is different…


and says “If a class is marked abstract, then it cannot be instantiated directly using the Create constructor. “

When did they introduce this keyword – and why did they not stick with the XE design?  Go figure…

Is there a QP or QC for this?

13 thoughts on “Missing warning?

  1. Stefan Glienke – IMO, it needs to at least output a warning.  Isn’t the whole idea of an abstract class, that it simply is a “template” for actual implementations to inherit from?