如题。分别说明多个位置的优缺点,极度欢迎。

解决方案 »

  1.   

    注:仅限简单类型的变量。如:Integer
      

  2.   

    e:integer;  //和published中定义一样
      private
       c:integer;   //此类内可以用
        { Private declarations }
      public
       d:integer;   //外部可以调用
      published
       f:integer;   //和public效果差不多
        { Public declarations }
      end;var
      Form1: TForm1;
      a:integer;      //省的写var,调用此form的单元都可以使用此变量
    implementation
    var
      b:integer;      //也可以
      

  3.   

    为了方便大家讨论,大家可以用下面的“位置X”表示某位置:unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;//位置 1type
      TForm1 = class(TForm)
      private
        { Private declarations }
        //位置 2
      public
        { Public declarations }
        //位置 3
      end;var
      Form1: TForm1;
    //位置 4
    implementation{$R *.dfm}//位置 5//SomeProc//位置6
    procedure UseVar6;
    begin
    //这个过程及下面几个过程要用到位置6的变量
    end;end.
    //还有其他的位置吗?欢迎讨论
      

  4.   

    能不能帮我解决http://community.csdn.net/Expert/topic/5440/5440023.xml?temp=.5701868
    问题,感激不尽