Difference between revisions of "Class constants"

From Lazarus wiki
Jump to navigationJump to search
(Created page with "FP supports typed class constants, if the compiler-switch <syntaxhighlight lang="pascal"> {$static on} </syntaxhighlight> is set. There are no untyped class constants. <synta...")
 
(Categorization)
Line 22: Line 22:
 
== Weblinks ==
 
== Weblinks ==
 
* [http://www.freepascal.org/docs-html/ref/refse28.html#x64-710005.3 “Static fields”] in FPC-doc
 
* [http://www.freepascal.org/docs-html/ref/refse28.html#x64-710005.3 “Static fields”] in FPC-doc
 +
 +
[[Category:FPC]]
 +
[[Category:Pascal]]

Revision as of 01:43, 3 November 2014

FP supports typed class constants, if the compiler-switch

{$static on}

is set. There are no untyped class constants.

	type
		TCars = class(TVehicles)
			private
			public
				wheelcount: integer: static;
		end;
	
	begin
		TCars.wheelcount := 4;
		(* further assignments are forbidden *)
	end.

Weblinks