在书上看到如下自定义记录:
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中的区别是什么?
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中的区别是什么?
解决方案 »
- [delphi]class var、class procedure与var、procedure有何区别?
- Delphi读取.dat文件
- 小弟斗胆发个贴:我准备写一本关于Delphi的书籍先把目录贴出来,准备接受大家的板砖
- 过了四级,散点分!
- 急~关于数据库MoveLast问题,谢谢
- 没有错误原因,但编译之后说不能生成可执行文件?为什么?
- 如何实现多个webbrowser使用多个代理?
- 急救!!为什么数据表的字段用中文总是出错
- 怎样显示gif图片
- 我想找一位会用Delphi开发asp的高手共同进步
- 如何取SQLSERVER服务器时间,在客户端
- Delphi中TColor()与RGB()的区别是什么?
好处吗就是节省内存啊放在interface和implementation中区别不大
但要注意,不可能两个单元交叉在interface中引用
所以,一个在interface,另 一个在implement中
在interface部分申明的变量,它的作用域将扩展到使用Uses语句申明本单元的其它单元中。
变体记录怎么理解啊,能说清楚点吗?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 有什么区别?
但是如果再有别的单元引用这个单元的话,区别就大了。
比如说,unit1 引用了unit2,
unit3 引用了 unit1,
如果unit1是在 interface 引用的unit2,那么这时候 unit3也可以访问unit2了。
如果unit1是在 implementation 引用的 unit2的话, 那么 unit3是不能访问 unit2的。
你看看这个贴子吧
http://expert.csdn.net/Expert/topic/2517/2517649.xml?temp=.3534052