This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Last revision Both sides next revision | ||
tutorial:class [2019/01/28 10:09] admin |
tutorial:class [2019/01/29 08:20] admin |
||
---|---|---|---|
Line 38: | Line 38: | ||
end; | end; | ||
- | __**หมายเหตุ**__ - ในการสร้าง Class ทุกๆครั้งที่ไม่ได้ระบุว่าสืบทอดมาจาก Class ใด จะเป็นการสร้าง Class สืบทอดจาก TObject ซึ่งเป็น Class พื้นฐานของ FPC เสมอ \\ \\ | + | __**หมายเหตุ**__ - ในการสร้าง Class ทุกๆครั้งที่ไม่ได้ระบุว่าสืบทอดมาจาก Class ใด จะเป็นการสร้าง Class สืบทอดจาก TObject ซึ่งเป็น Class พื้นฐานของ FPC เสมอ \\ |
+ | |||
+ | ตัวอย่างการสร้าง Class แบบละเอียด | ||
+ | <sxh delphi;> | ||
+ | Type | ||
+ | TMyClass = class(TObject) | ||
+ | private | ||
+ | FName:string; | ||
+ | FValue:integer; | ||
+ | protected | ||
+ | function GetIsOK:boolean; | ||
+ | public | ||
+ | constructor create; | ||
+ | destructor destroy; override; | ||
+ | procedure DoSomeThing; | ||
+ | published | ||
+ | property Name:string read FName write FName; | ||
+ | property Value:integer read FValue write FValue default 0; | ||
+ | property IsOK:boolean read GetIsOK; | ||
+ | end; | ||
+ | </sxh> | ||
+ | |||
+ | \\ | ||
+ | |||
+ | \\ | ||
---- | ---- | ||
=====Property===== | =====Property===== |