[DUG] basic question

Jeremy North jeremy.north at gmail.com
Wed Jul 25 17:17:26 NZST 2007


>  TShowOff = class
>  public
>    class var Count: Integer; // Hmm, I wonder what they call this.
>    class procedure Static1;
>    class procedure Static2; static;
>  end;

I much prefer to align my code differently though, since once one
Class var has been defined, all subsequent variables are also treated
as Class vars.

type
  TSomeClass = class
  public
    NotAClassVar: string;
    class var
      Hello: string;
      Goodbye: string;
    class procedure ShowIt;
    class procedure ShowIt2;
  end;

{ TSomeClass }

class procedure TSomeClass.ShowIt;
begin
  ShowMessage(Hello);
end;

class procedure TSomeClass.ShowIt2;
begin
  ShowMessage(Goodbye);
end;

end.


More information about the Delphi mailing list