unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations}
  public
    { Public declarations }
  end;var
  Form1: TForm1;
  s:string[23] ;
  hw:hwnd;
implementation
{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
 var xx :temployee;
 xx:=temployee.create;
  s[0]:='h1';
  form1.Label1.Caption :=s[0];
end;end.
'----------------------------------------------------下边那个结构要写到哪老提示运行到NAME那一个成员提示有误
typeTemployee = class(TObject);Name := String[25];Title := String[25];HourlyPayRate : Double;function CalculatePayAmount:Double;end.

解决方案 »

  1.   

    在线等,才开始学DELPHI,感觉有点不太适应
      

  2.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Label1: TLabel;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;  Temployee = class(TObject)
        Name : String[25];
        Title : String[25];
        HourlyPayRate : Double;
      end;  function CalculatePayAmount():Double;var
      Form1: TForm1;implementationfunction CalculatePayAmount():Double;
    begin
        result := 0.0;
    end;{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
        //
    end;end.
      

  3.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Label1: TLabel;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
         function CalculatePayAmount():Double;//如果其它单元没有调用它,请放在这作为私有
      public
        { Public declarations }    
      end;  Temployee = class(TObject)
        Name : String[25];
        Title : String[25];
        HourlyPayRate : Double;
      end;
    var
      Form1: TForm1;implementationfunction CalculatePayAmount():Double;
    begin
        result := 0.0;
    end;{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
        //
    end;end.
      

  4.   

    function CalculatePayAmount:Double;是Temployee类的吧?
      

  5.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Label1: TLabel;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;  Temployee = class(TObject)
        Name : String[25];
        Title : String[25];
        HourlyPayRate : Double;
        function CalculatePayAmount():Double;
      end;var
      Form1: TForm1;implementation{$R *.dfm}function Temployee.CalculatePayAmount():Double;
    begin
        result := 0.0;
    end;procedure TForm1.Button1Click(Sender: TObject);
    var xx :temployee;  //定义变量放到begin之前
    begin
     xx:=temployee.create;
      s[0]:='h1';
      form1.Label1.Caption :=s[0];
    end;
    end.