Delphi custom class notes (2)
Leave members who do not reserve words
Two situations where the beginning of the class is not retained
First, in the area of Private, Protected, Public, Published, non-first class members can not add these reserves (omitted)
Second, if the class is within the four four scope of this above, there are several members who have no reserved words in the beginning part of the class, and their site is divided into two types:
A. This class or you use the "{$ m }" compile instruction, the default is a public member
B. This class or your class does not use the "{$ m }" compiling instruction, the default is public member
Change rules for members closed grades
Change method: I only need to re-declare the declaration area of sub-class members.
Follow the rules: expand the visibility of the member, but do not narrow the visibility of the member.
Because narrowing certain member visibility makes some member visibility, it is possible to prevent these members that cannot be accessed and causing compilation errors.
Definition and implementation of class members
Class member
Field, method, attribute
Implementation of fields and object references
Field: Refers to the word in the narrow range - refers to the member variables that the object is also owned.
(1) Package of member variables is usually in private this level
(2) The definition of member variables must be defined earlier than any attribute or method
(3) There is no limit to the type of member variable.
If the member variable belongs to the class class, this situation we call this member variable as "object reference"
method
(1) Class name. Method name
Attributes
Difference to the field;
(1) The field is just a space that reserves the data, the attribute can be accessed, and some read and write operations are performed.
(2) Attributes need to add a reserved word Property, and some related read and write methods are provided
Inheritance
Polymorphism