如何把常量转为变量

解决方案 »

  1.   

    你可以定义常量类型
    const
      A: Integer = 10;
    使用中可以进行赋值.
      

  2.   

    不是很明白楼主的意思,楼主是不是指调用的参数有const关键字,这个是指,你传入的变量不能被修改,但是可以传变量的
      

  3.   

    Type Switch
    Syntax {$J+} or {$J-}
    {$WRITEABLECONST ON} or {$WRITEABLECONST OFF}
    Default {$J+}
    {$WRITEABLECONST ON}
    Scope Local
    The $J directive controls whether typed constants can be modified or not. In the {$J+} state, typed constants can be modified, and are in essence initialized variables. In the {$J-} state, typed constants are truly constant, and any attempt to modify a typed constant causes the compiler to report an error.
    In previous versions of Delphi and Borland Pascal, typed constants were always writeable, corresponding to the {$J+} state. Old source code that uses writeable typed constants must be compiled in the {$J+} state, but for new applications it is recommended that you use initialized variables and compile your code in the {$J-} state.