User Tools

Site Tools


tutorial:proceduraltype

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tutorial:proceduraltype [2018/10/28 12:23]
admin [Function of Object]
tutorial:proceduraltype [2018/10/28 12:32] (current)
admin
Line 109: Line 109:
  
   Type    Type 
-    TFunc = function(x:​real):​real of object ​;+    TFunc = function(x:​real):​real of Object ​;
  
 <hidden Example-3: Function of Object (TForm)> <hidden Example-3: Function of Object (TForm)>
Line 180: Line 180:
 ---- ----
 =====Function is Nested===== =====Function is Nested=====
 +สำหรับการทำ Nested Function ให้กลายเป็น Procedural Type เพื่อส่งผ่านเป็นตัวแปรนั้น เราสามารถระบุ Function ดังกล่าวได้ตามนี้
  
 +  Type 
 +    TFunc = function(x:​real):​real is Nested ;
 +
 +จะสังเกตได้ว่าคล้ายกับการระบุ Function of Object นั่นเอง เพียงแต่เปลี่ยนจากคำว่า of Object เป็น is Nested แต่อย่างไรก็ตามสิ่งที่แตกต่างกันอีกอย่างหนึ่ง คือ คำสั่งข้างต้น จำเป็นต้องระบุ Compiler Directive ดังนี้ก่อนเสมอ ​
 +
 +  {$modeswitch nestedprocvars}  ​
 +  ​
 +  ​
tutorial/proceduraltype.1540704230.txt.gz · Last modified: 2018/10/28 12:23 by admin