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 ...
随机推荐
- 资源的GPUAddress
BufferAddress CommandHandle TextureHandle 给shader采样的 ImageHandle 给shader load store的.../imageLoad() ...
- ASP.NET MVC学习---(八)三个比较常用的方便的功能
通过之前的了解 现在我们已经可以使用mvc进行一些简单的开发 但是还不够 哪里不够呢? 为什么现在的程序员喜欢用mvc进行开发 不就是因为它爽吗? 之前介绍的那些特点仅仅是mvc框架的一小部分 只是一 ...
- sql 查询重复的数据
select * from yryz_role_partner where user_id in (select user_id from yryz_role_partner group by use ...
- 模拟select控件&&显示单击的坐标&&用户按下键盘,显示keyCode
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- @property和@x.setter和@x.deleter表示可读可写可删除
@property可以将python定义的函数“当做”属性访问,从而提供更加友好访问方式,但是有时候setter/deleter也是需要的.1>只有@property表示只读.2>同时有@ ...
- POJ 2375 Cow Ski Area (强连通分量)
题目地址:POJ 2375 对每一个点向与之相邻并h小于该点的点加有向边. 然后强连通缩点.问题就转化成了最少加几条边使得图为强连通图,取入度为0和出度为0的点数的较大者就可以.注意,当强连通分量仅仅 ...
- 【VBA】VBA编写的,将一列中相同的内容的行提取出来单独生成文件
数据如上图所示,点击RUN后的运行结果如下: 得到该文件夹,文件夹内容如上图. 代码如下: Private Sub Command_OLIVER() Dim arr arr = Range(" ...
- 【HTML5】summary交互元素
1.源码 <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"/> <tit ...
- windows下WMI使用C++查询用户硬件信息
最近需要做下用户信息统计,发现WMI真是个好东西,同时觉得COM这东西,还真不能少>_<!! 下面是源码: /*************************************** ...
- 超高逼格Log日志打印
代码地址如下:http://www.demodashi.com/demo/12646.html 前言 Log日志的打印一直是一个比较头疼的事,怎样才能让自己的log显示更多信息,怎样才能让自己的log ...