[fpc-devel] Class property and virtual getter
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Fri Feb 28 02:18:21 CET 2014
Sven Barth schrieb:
> Am 27.02.2014 15:35, schrieb Hans-Peter Diettrich:
>> Also "self" is no more known inside class methods in XE. In D7 it was
>> the class type instead of the instance pointer. Thus a too restrictive
>> compiler, geared towards compatibilitiy with *new* Delphi versions,
>> may break existing code.
> Source please. This compiles and runs without problems in XE:
>
> === source begin ===
>
> type
> TTest = class
> class procedure Test; <---------
> end;
When you add "static;", as required for class property getters/setters,
the following won't compile:
> class procedure TTest.Test;
> begin
> Writeln(Self.ClassName);
> end;
So the lack of "Self" seems to apply to "static;" methods, not to
"class" methods. I'll ask in an EMBT group for a description of
"static;", the OH seems to reflect the C++ meaning only, without
mentioning the impact on OPL classes.
DoDi
More information about the fpc-devel
mailing list