Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class variables in Delphi 7

Following is the code in which I try to declare class variable:

  type TMyClass = class

  private
    class function ABC(myID : integer): string;
  public
    class var s: String;
    class function XYZ: string;
  end;

I am getting error: PROCEDURE or FUNCTION expected. Is there any change in syntax of class variable in Delphi 7?

like image 379
Meraqp Avatar asked Mar 20 '26 08:03

Meraqp


1 Answers

Delphi 7 didn't support class variables. You'll have to find another way of solving your problem. An easy fix is probably just to make it be a global variable of the enclosing unit instead.

like image 104
Rob Kennedy Avatar answered Mar 24 '26 04:03

Rob Kennedy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!