Original Post
Hi there! I''m wondering if there''s anything to compare with "class function" for member variables, like with "static" in C++ or Java. The closest I''ve managed is variables after the implementation part, like this:
unit something;
interface
type
TSomething = class
protected
class function GetMyVar: Integer;
public
end;
implementation
var
FMyVar: Integer = 0; // the static variable
class function TSomething.GetMyVar: Integer;
begin
Result := FMyVar;
end;
end.
The class function is for descended classes. Of course, because the variable is declared after the implementation section, it can''t be seen outside the unit without such a function.
You can make a public property to access the variable if that''s what you want.
This method works fine, and I haven''t run into any problems with it, but I just wondered if there was a specific keyword for this.
Alistair Keys
My web site (due for an update sometime soon, including more demo effects and cleaned up code, plus better tutorials)
"There are two kinds of people, those who finish what they start and so on."
-- Robert Byrne