Delphi source Program Format Writing specification (i) (3)

Source: Internet
Author: User

3.4.3 Enumeration types

The name of the enumerated type must be meaningful and the type's name preceded by a prefix ' T '. The name of the content of the enumeration type must contain shorthand for the enumeration type name, for example:

Tsongtype = (Strock, stclassical, Stcountry, Stalternative, Stheavymetal, STRB);

3.4.4 Array type

The name of the array type must be meaningful and the name of the type should prefix ' T '. If you declare a pointer to an array type, you must prefix ' P ' before the type's name, for example:

Type
Pcyclearray = ^tcyclearray;
Tcyclearray = array[1..100] of integer;

3.4.5 Record Type

The name of the record type must be meaningful and the name of the type should prefix ' T '. If you declare a pointer to an array type, you must prefix ' P ' before the type's name, for example:

Type
Pemployee = ^temployee;
Temployee = Record
Employeename:string
employeerate:double;
End


3.5 class

3.5.1 Nomenclature and format

The name of the class must be meaningful and the name of the type should prefix ' T '. For example:

Type
Tcustomer = Class (TObject)

The name of the class instance is usually the name of the class that removes the ' T '. For example:

Var
Customer:tcustomer;

Variables in the 3.5.2 class

3.5.2.1 nomenclature and format

The name of the class must be meaningful and the name of the type preceded by a prefix of ' F '. All variables must be four. If you need to access this variable externally, you need to declare a property

3.5.3 method

3.5.3.1 nomenclature and format

Name and format of the same function and procedure.

3.5.3.2 Property access Method

All property access methods must appear in private or protected. The naming of property access methods and the naming of functions and procedures (reader method) must use the prefix ' get '. Write methods (writer method) must use the prefix ' Set '. The parameter of the Write method must be named ' Value ', which is the same type as the property being written. For example:

Tsomeclass = Class (TObject)
Private
Fsomefield:integer;
Protected
function Getsomefield:integer;
Procedure Setsomefield (Value:integer);
Public
Property Somefield:integer read Getsomefield write Setsomefield;
End

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.