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 ...
随机推荐
- [置顶]
kubernetes将外部服务映射为内部服务
在实际应用中,一般不会把mysql这种重IO.有状态的应用直接放入k8s中,而是使用专用的服务器来独立部署.而像web这种无状态应用依然会运行在k8s当中,这时web服务器要连接k8s管理之外的数据库 ...
- Mac eclipse安装SVN javaHL not available的解决方法
在Mac下安装Eclipse插件svnEclipse插件后,每次打开Eclipse都会弹出如下弹出框: 提示你本机缺少JavaHL Library. 选择Eclipse→偏好设置(preference ...
- ElasticSearch 结构化搜索
1.介绍 结构化搜索(Structured search) 是指有关探询那些具有内在结构数据的过程.比如日期.时间和数字都是结构化的:它们有精确的格式,我们可以对这些格式进行逻辑操作. 比较常见的操作 ...
- 2017.7.27 logback配置文件
参考来自: Java深入 - logback的配置和使用 1 模块组成 logback分成三个模块:logback-core,logback- classic和logback-access. logb ...
- 基于Storyboard的创建多分支NavigationController的方法
如果遇到本文图片只展示一半的情况,多数情况下刷新一下浏览器即可 遇到的问题 我在写程序的时候碰到这样一个简单的需求,用户点击"我的XX"这样的功能时候,需要判断当前用户是否已经登录 ...
- MyBatis Generator生成DAO——序列化
MyBatis Generator生成DAO 的时候,生成的类都是没有序列化的. 还以为要手工加入(開始是手工加入的),今天遇到分页的问题,才发现生成的时候能够加入插件. 既然分页能够有插件.序列化是 ...
- AngularJS, Ember.js, Backbone这类新框架与 jQuery的重要区别在哪里?
jQuery主要是用来操作DOM的,如果单单说jQuery的话就是这样一个功能,它的插件也比较多,大家也都各自专注一个功能,可以说jQuery体系是跟着前端页面从静态到动态崛起的一个产物,他的作用就是 ...
- ios网络学习------10 原生API文件上传
使用原生态的api上传文件的实现: #import "MainViewController.h" @interface MainViewController () @propert ...
- 【引用】python 静态函数 类函数 实例函数
1.关于定义类的一些奇特之处 今天在Python中定义一个类,很奇怪,不需要事先声明它的成员变量吗?暂时不知,先记录下来: class Account(object): "一个简单的 ...
- 用SwiftGen管理UIImage等的String-based接口
代码地址如下:http://www.demodashi.com/demo/12149.html 问题现状 平时我们使用UIImage,UIFont,UIColor会遇到很多String-based的接 ...