Delphi 为什么在TObject中使用“T”前缀?
当声明类等时,TObject中的T代表什么?模板 例如:Delphi 为什么在TObject中使用“T”前缀?,delphi,tobject,Delphi,Tobject,当声明类等时,TObject中的T代表什么?模板 例如: procedure TfrmMain.CaptureInfo1Click(Sender: TObject); begin frmCapture.Show; end; 据我所知,它代表类型。据我所知,它代表类型。德尔福有许多官方认可的前缀。 这些都是Borland约定的,编译器不强制执行 Prefix | Used for | Notes -------+----------+-----------------------------
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使用ALLCAPS表示常量,使用前导caps表示类型的技巧不起作用 所有这些以及更多内容将在更具体的一节中进行概述。
这是Borland等人编写的所有源代码都遵循的风格,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使用前缀的原因是该语言不区分大小写,因此C/Java使用ALLCAPS表示常量,使用前导caps表示类型的技巧不起作用 所有这些以及更多内容将在更具体的一节中进行概述。
这是Borland等人编写的所有源代码都遵循的风格,不过我有点喜欢A前缀,因为它减少了冲突或混淆的风险。例如,我确实编写了FLimit:=ALimit。有时我会在枚举前面放一个小[e],其中用户定义的TFontStyle枚举将是eFontStyle。但我最近切换到et作为枚举类型,以使代码完成列表更小。不过,我有点喜欢a前缀,因为它减少了冲突或混乱的风险。例如,我确实编写了FLimit:=ALimit。有时我在枚举前面放了一个小[e],其中用户定义的TFontStyle枚举将是eFontStyle。但我最近切换到et作为枚举类型,以减小代码完成列表。