當聲明課程等時,TObject
中的「T」代表什麼?模板?爲什麼TObject中的「T」前綴?
例子:
procedure TfrmMain.CaptureInfo1Click(Sender: TObject);
begin
frmCapture.Show;
end;
當聲明課程等時,TObject
中的「T」代表什麼?模板?爲什麼TObject中的「T」前綴?
例子:
procedure TfrmMain.CaptureInfo1Click(Sender: TObject);
begin
frmCapture.Show;
end;
它代表 「類型」,據我所知。
德爾福有一些官方認可的前綴。
這些都是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使用前綴是語言不區分大小寫,因此使用全大寫的常量和領先的上限類型的C/Java的伎倆行不通。
所有這些以及更多內容在Object Pascal Style Guide中進行了概述,更具體而言是Naming Convention。
這是所有源代碼編寫由Borland等人跟隨
我的風格有點像'A'前綴,不過,因爲它減少衝突或混亂的風險。它確實發生了,例如,我寫了'FLimit:= ALimit'。 – 2016-08-16 20:57:46