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 ...
随机推荐
- linux stdin(0)/ stdout(1) / stderr(2)
在shell中,每个进程都和三个系统文件相关联:标准输入stdin,标准输出stdout.标准错误stderr,三个系统文件的文件描述符分别为0,1.2.进程需要的输入来自stdin文件.进程的标准输 ...
- C中存储分区详解
一. 在c中分为这几个存储区:栈(stack),堆(heap),代码段(text),数据段(data),bss 段,常量存储区,1.栈(stack):由编译器自动分配释放自动分配,自动回收:栈区里面存 ...
- 浙大PAT考试1077~1080(2014上机复试题目)
题目地址:点击打开链接 还是太弱. . 英文太差.,, 预计要等待被虐了.. 1077 找最长的公共后缀,暴力就能够写: #include<iostream> #include<cs ...
- 使用ffmpeg截取视频封面并批量上传
需求:将视频文件压入zip包,然后上传服务器.服务器对zip解压,使用bat/shell,使用ffmpeg对视频进行封面截取.再使用OSS对视频和封面进行批量上传.最后将信息存入数据库 遇到的问题 1 ...
- 2017.7.21 linux下进程管理工具supervisord的安装与使用
参考来自:http://blog.haohtml.com/archives/15145 0 操作环境 1 supervisord的介绍 Supervisord是用Python实现的一款非常实用的进程管 ...
- HTML5 Canvas 画钟表
画钟表是2D画图的老生常谈,我也不能免俗弄了一个.代码如下: <!DOCTYPE html> <html lang="utf-8"> <meta ht ...
- java学习笔记——Collection集合接口
NO 方法名称 描述 1 public boolean add(E e) 向集合中保存数据 2 public void clear() 清空集合 3 public boolean contains(O ...
- goruntine
一.出让时间片 runtime.Gosched() 二.同步锁 Go语言包中的sync包提供了两种锁类型:sync.Mutex和sync.RWMutex.Mutex是最简单的一种锁类型,同时也比较暴力 ...
- android 4.0 禁用系统home键
2.2 禁用系统home键.这里不说了. 近期项目有一个需求,禁用系统的全部键.像menu, home, back.同一时候还要是想点击响应与view的弹出. 就是UI这部分要正常. back键我们自 ...
- 【BIEE】07_调整BIEE柱子的显示顺序
现在有报表如下: 但是我们觉得这种显示不好看,想把非优秀员工的柱子放在前边显示,那么如何调整呢? 调整步骤: [编辑分析] 我们将此处条形图下的两个标签顺序重新调整一下 从上图可以看出,效果明显!