[WayBack] E2398 Class methods in record types must be static (Delphi) – RAD Studio present since at least Delphi 2007 ([WayBack] E2398: Class methods in record types must be static).
This is a Delphi compiler limitation for records, that is not present for classes.
Maybe one day when record inheritance kicks in, this will be resolved (as Stefan Glienke hinted in the below tread), because currently Self
(which is present in non-static class methods on classes) then points to the current type. In static
class methods, there is no Self
, which is OK as that would point to the only available type anyway.
Via: [WayBack] why a class method of a record without the static keyword raise E2998 error ? AFAIK it can not be anything else then static ?! – Paul TOTH – Google+
Note that [WayBack] Error and Warning Messages (Delphi) – RAD Studio shows various other errors around the use of static
:
- [WayBack] E2355 Class property accessor must be a class field or class static method (Delphi) – RAD Studio
- [WayBack] E2366 Global procedure or class static method expected (Delphi) – RAD Studio
- [WayBack] E2376 STATIC can only be used on non-virtual class methods (Delphi) – RAD Studio
- [WayBack] E2380 Instance or class static method expected (Delphi) – RAD Studio
All are marked “No further information is available for this error or warning.“, though they would at least deserve some examples.
–jeroen