在书上看到如下自定义记录:
type 
  TVariantRecord = record 
    NullStrField: Pchar;
    IntField : Integer;
  case Integer of 
    0:(D:Double);
    1:(I:Integer);
    2:(C:Char);
 end;
请问这里的:
   case  Integer of 
    0:(D:Double);
    1:(I:Integer);
    2:(C:Char);
是什么意思?有什么作用?具体如何使用? 请高手举例说明一下.
还有就是uses unitA放在interface和implementation中的区别是什么?

解决方案 »

  1.   

    用的是变体记录啊,就像以中的uion
    好处吗就是节省内存啊放在interface和implementation中区别不大
    但要注意,不可能两个单元交叉在interface中引用
    所以,一个在interface,另 一个在implement中
      

  2.   

    在implementation部分申明的变量,只能在本单元使用,而不能在单元外使用。
    在interface部分申明的变量,它的作用域将扩展到使用Uses语句申明本单元的其它单元中。
      

  3.   

    TO:liyangyao970(纳兰容若) 
    变体记录怎么理解啊,能说清楚点吗?TO:flyforlove(为情飞) 
    我是说在单元引用的时候:例如: 
    ....
    var
      frmMain: TfrmMain;
    implementation
     uses
        Udesign_public,Ukind,Uunit, Ucljbzl,Ubomzl, Ucustomer,
      Upojbzl, UProducePlan,Uxyzl, Ubjd,UtableInfo;如果把Udesign_public等放在:
    unit Umain;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      Menus, StdCtrls, Buttons, Mask, DBCtrls,Udesign_public......;这两种uses 有什么区别? 
      

  4.   

    单元引用的时候,对于这个单元本身来说,这之间的区别不大,
    但是如果再有别的单元引用这个单元的话,区别就大了。
    比如说,unit1 引用了unit2,
    unit3 引用了 unit1,
    如果unit1是在 interface 引用的unit2,那么这时候 unit3也可以访问unit2了。
    如果unit1是在 implementation 引用的 unit2的话, 那么 unit3是不能访问 unit2的。
      

  5.   

    楼上的不错,
    你看看这个贴子吧
    http://expert.csdn.net/Expert/topic/2517/2517649.xml?temp=.3534052