簡體   English   中英

為什么在TObject中使用“ T”前綴?

[英]Why the “T” prefix in TObject?

在聲明類等時, TObject中的“ T”代表什么? 模板?

例:

procedure TfrmMain.CaptureInfo1Click(Sender: TObject);
begin
  frmCapture.Show;
end;

Delphi有許多官方認可的前綴。
這些都是Borland約定,並非由編譯器強制執行。

Prefix | Used for | Notes
-------+----------+---------------------------------------------
   T   | types    | Denotes a structured type, class or record
   I   |interfaces| For interfaces, e.g. IInterface
   F   | Field    | Private Field in a class or record
  xx   | enum     | Enumeration members have a 2 char prefix
       |          | e.g.  fsBold, fsItalic for the TFontStyle enum  
   A   | params   | deprecated ! All method params at one point started with an `A`.
                    this convention is no longer encouraged. 

Note that the capitalization is as shown.

Delphi使用前綴的原因是該語言不區分大小寫,因此使用ALLCAPS作為常量和Leading caps作為類型的C / Java技巧不起作用。

所有這些以及更多內容在《 對象Pascal樣式指南》中進行了概述,更具體地說是“ 命名約定”部分。
這是Borland等人編寫的所有源代碼都遵循的樣式

據我所知,它代表“類型”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM