Thema: Delphi globale Konstante?

Einzelnen Beitrag anzeigen

bwolf

Registriert seit: 17. Jan 2006
368 Beiträge
 
Delphi 2009 Professional
 
#4

Re: globale Konstante?

  Alt 11. Sep 2009, 12:06
Hm, bin wohl bescheuert.

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

const
  CONST1 : integer = 1234;

type
  TForm1 = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
    var1 : string;
  end;

var
  Form1: TForm1;

const
  CONST2 : integer = 1234;


implementation

{$R *.dfm}

end.
Delphi-Quellcode:
unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm2 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

uses Unit1;

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
  // zugriff auf var1 aber nicht auf CONST1 und CONST2 ??
end;

end.
  Mit Zitat antworten Zitat