Delphi Property详解
http://anony3721.blog.163.com/blog/static/51197420107105132120/?ignoreua
Property
Keyword Defines controlled access to class fields System unit
?.Property Name : Type read Getter|nodefault;
?.Property Name : Type write Setter;
?.Property Name : Type read Getter write Setter;
?.Property Name : Type Index Constant read Getter {default : Constant|nodefault;} {stored : Boolean};
?.Property Name : Type Index Constant write Setter {default : Constant|nodefault;} {stored : Boolean};
?.Property Name : Type Index Constant read Getter write Setter {default : Constant|nodefault;} {stored : Boolean};
?.Property Name[Index : IndexType] : BaseType read Getter {default;}
?.Property Name[Index : IndexType] : BaseType write Setter; {default;}
?.Property Name[Index : IndexType] : BaseType read Getter write Setter; {default;}
.Property Name : Type read Getter implements Interfaces...;
.Property Name; // Redeclared base class property
.Property Name : Type; // Dispinterface only
.Property Name : Type readonly; // Dispinterface only
.Property Name : Type writeonly; // Dispinterface only
|
Example code : Illustrating basic and indexed properties |
// Full Unit code. // ----------------------------------------------------------- // You must store this code in a unit called Unit1 with a form // called Form1 that has an OnCreate event called FormCreate. unit Unit1; interface uses type Property Right : Longint Index 2 read GetCoord write SetCoord; constructor Create; // The form class itself var implementation {$R *.dfm} // TRectangle property 'Getter' routine function TRectangle.GetCoord(Index: Integer): Longint; // TRectangle property 'Setter' routine // And recreate the rectangle area // Main line code begin // And set the corner coordinates // And ask for these values // And show the rectangle area end. |
Show full unit code |
myRect coord 0 = 22 myRect coord 1 = 33 myRect coord 2 = 44 myRect coord 3 = 55 myRect area = 484 |
Delphi Property详解的更多相关文章
- Delphi 关键字详解
Delphi 关键字详解[整理于 "橙子" 的帖子] absolute //它使得你能够创建一个新变量, 并且该变量的起始地址与另一个变量相同. var Str: ]; S ...
- Objective-C中的@Property详解
Objective-C中的@Property详解 @Property (属性) class vairs 这个属性有nonatomic, strong, weak, retain, copy等等 我把它 ...
- Delphi指针详解
Delphi指针详解2007-12-04 06:08:57| 分类: DLL学习 阅读91 评论0 字号:大中小 订阅 大家都认为,C语言之所以强大,以及其自由性,很大部分体现在其灵活的指针运用 ...
- Delphi多线程详解
(整理自网络) Delphi多线程处理 1-1多线程的基本概念 WIN 98/NT/2000/XP 是个多任务操作系统,也就是:一个进程可以划分为多个线程,每个线程轮流占用CPU 运行时间和资源,或者 ...
- Delphi 关键字详解[整理于 "橙子" 的帖子]
absolute //它使得你能够创建一个新变量, 并且该变量的起始地址与另一个变量相同. var Str: ]; StrLen: Byte absolute Str; //这个声明指定了变量 ...
- 【转】Delphi 关键字详解
absolute //它使得你能够创建一个新变量, 并且该变量的起始地址与另一个变量相同. var Str: string[32]; StrLen: Byte absolute Str; //这个声明 ...
- Delphi函数详解:全局函数,内部函数,类的成员函数,类的静态方法
1. Delphi中的全局函数 //要点: 需要给其他单元调用, 必须在 interface 声明, 但必须在 uses 区后面 unit Unit1; interface uses Window ...
- OC中的@property详解
简介: @property 生成了变量的get set 方法,同时指定了变量名称. 例如@property (nonatomic,strong) NSString *name;表示生成了_name私有 ...
- python property详解
Python中有一个被称为属性函数(property)的小概念,它可以做一些有用的事情.在这篇文章中,我们将看到如何能做以下几点: 将类方法转换为只读属性 重新实现一个属性的setter和getter ...
随机推荐
- 设计模式之观察者模式(php实现)
github地址:https://github.com/ZQCard/design_pattern /** * 当对象间存在一对多关系时,则使用观察者模式(Observer Pattern). * 比 ...
- django模板解析 循环列表中 切片和求长度
{% for subrow in subdic.content|slice:":5" %} {% endfor %} {% if "{{subdic.content|le ...
- 如何对POST请求但是URL中也有参数/GET请求但是请求体中也有参数的情况进行安全扫描
通常情况下,GET的参数都在URL中,POST的参数都在请求体中,但是如题的情况也有,像使用方法PUT.DELETE的情况也有,这些情况该如何进行安全扫描呢?
- JPEG编码(二)
来自CSDN评论区http://bbs.csdn.net/topics/190980 1. 色彩模型 JPEG 的图片使用的是 YCrCb 颜色模型, 而不是计算机上最常用的 RGB. 关于色彩模型, ...
- CKEditor+SWFUpload实现功能较为强大的编辑器(二)---SWFUpload配置
在前面配置完CKEditor之后,就可以拥有一个功能挺强大的编辑器了 但是现在还不够,还要能够在发表文字中插入自己电脑上的图片 CKEditor自己好像有这个功能,但是实在是...没法说,很难用(这是 ...
- dmz主机就是DNAT功能的体现
端口映射和DMZ是提供内网和外网映射的,具体各自如下:DMZ:就相当于DNAT(Destination NAT),只对目的IP地址做地址转换.也就是说,收到目的IP为自己WAN口的包,统统转发给内网的 ...
- git学习资料及心得
1. 阮一峰的(简单易懂,实用性佳) http://www.ruanyifeng.com/blog/2015/12/git-cheat-sheet.html http://www.ruanyifeng ...
- Javascript 客户端实时显示服务器时间
<!doctype html> <html lang="zh-cn"> <head> <meta charset="utf-8& ...
- C# readonly和const的不同以及它的具体用法
在C#中,我们用const来定义常量.常量就是我定义一个变量,这个变量的值在整个软件的生命周期都不变.比如我想求一个圆形的面积,我就可以把π定义成一个常量,因为我事先知道圆周率是就是3.1415926 ...
- mysql负载飙高原因分析
某些进程/服务消耗更多CPU资源(服务响应更多请求或存在某些应用瓶颈):发生比较严重的swap(可用物理内存不足):发生比较严重的中断(因为SSD或网络的原因发生中断):磁盘I/O比较慢(会导致CPU ...