On 24 Nov 2012, at 17:55, bsquared wrote: > I followed the example on the wiki page, but the compiler disallowed both of > the following attempts.
On which wiki page did you find this code? > {$mode objfpc}{$H+} > > TExample1 = class > private > const > CN_CONST = 'EXAMPLE CONSTANT'; > published > property Example: string > read CN_CONST; > end; > > Error: Unknown class field or method identifier "CN_WELCOME" Properties can only read via methods or fields, not via constants. A constant is not the same as a field. Does Delphi allow the above? > TExample2 = class > private > fExample: string; > const > CN_CONST = 'EXAMPLE CONSTANT'; > published > property Example: string > read fExample > write fExample > default CN_CONST; > end; > > Error: Property can't have a default value Properties that return strings cannot have a default value. Only immediate values that moreover fit in 32 bits can be used as default value, due to the format of the RTTI. See http://bugs.freepascal.org/view.php?id=19199 for more information. > Also, What is the static keyword on the class method? > class procedure SetSomeClassVar(const AValue: TSomeType); static; It results in the class method not getting a hidden "self" parameter, which otherwise contains the class reference on which the class method was invoked. Jonas_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal