[英]Why the “T” prefix in TObject?
When declaring classes and so on, what does the "T" in TObject
stand for? 在声明类等时,
TObject
中的“ T”代表什么? Template? 模板?
Example: 例:
procedure TfrmMain.CaptureInfo1Click(Sender: TObject);
begin
frmCapture.Show;
end;
Delphi has a number of officially sanctioned prefixes. Delphi有许多官方认可的前缀。
These are all by Borland convention and are not enforced by the compiler. 这些都是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.
The reason Delphi uses prefixes is that the language is not case sensitive, so the C/Java trick of using ALLCAPS for constants and Leading caps for types does not work. Delphi使用前缀的原因是该语言不区分大小写,因此使用ALLCAPS作为常量和Leading caps作为类型的C / Java技巧不起作用。
All this and more is outlined in the Object Pascal Style Guide , more specifically the section Naming Convention . 所有这些以及更多内容在《 对象Pascal样式指南》中进行了概述,更具体地说是“ 命名约定”部分。
It's the style that all source code written by Borland et al follow 这是Borland等人编写的所有源代码都遵循的样式
据我所知,它代表“类型”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.