摘要: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton... 阅读全文
posted @ 2008-01-11 16:43 万一 阅读(4322) 评论(1) 推荐(0)
摘要: 什么是多态? 我的理解就是: 同样一个方法, 在不同的对象里会有不同的实现, 仅此而已. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TFor... 阅读全文
posted @ 2008-01-11 02:27 万一 阅读(6011) 评论(1) 推荐(0)
摘要: //这个类中的两个字段没有封装 TMyClass1 = class FName: string; FAge: Integer; end; //这个类中的两个字段封装了, 外部不能读写 TMyClass2 = class private FName: string; FAge: Integer; //public e... 阅读全文
posted @ 2008-01-11 02:26 万一 阅读(6457) 评论(5) 推荐(0)
摘要: 先新建一个 VCL Forms Application 工程, 代码中就已经出现了两个类: 一个是 TForm 类; 一个是 TForm1 类; TForm1 继承于 TForm. TForm 是 TForm1 的父类; TForm1 是 TForm 的子类. unit Unit1; interface uses Windows, Messages, SysUtils, Variant... 阅读全文
posted @ 2008-01-11 02:25 万一 阅读(7625) 评论(6) 推荐(0)
摘要: 先勾画一下思路: 1、建立一个类, 里面有年龄字段 FAge; 2、通过 Age 属性读写 FAge; 3、如果输入的年龄刚好是 100 岁, 将会激发一个事件, 这个事件我们给它命名为: OnHundred unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Cont... 阅读全文
posted @ 2008-01-11 02:24 万一 阅读(8878) 评论(10) 推荐(0)
摘要: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button... 阅读全文
posted @ 2008-01-11 02:22 万一 阅读(7897) 评论(8) 推荐(1)
摘要: 说到"类", 就会提到: 属性、方法、事件 (这是类包含的内容); 封装、继承、多态 (这是类的主要用途). 下面定义并调用了了一个过程 MyProc、一个函数 MyFun. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, ... 阅读全文
posted @ 2008-01-11 01:23 万一 阅读(7396) 评论(10) 推荐(2)
摘要: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button... 阅读全文
posted @ 2008-01-11 00:39 万一 阅读(13044) 评论(16) 推荐(0)