When talking about the reference of the Delphi class, I mentioned in <Delphi Technical Manual>:
An object is a memory block used to store the values of each field of a class.
Object Reference is the pointer to this object.
The class table is used to store read-only pointers and related information pointing to VMT.
Class reference is the pointer to this class table
It is defined as follows:
- Tclass = Class of type;
- // Example
- Tclass = Class of tobject;
The tobject class type is as follows:
- Function tobject. classtype: tclass;
- Begin
- Pointer (result): = ppointer (Self) ^;
- End;
Ppointer (Self) ^ should be equal
Pointer (pointer (Self) ^), Self is an instance pointing to an object,
The first four bytes of an object are a pointer to the VMT table, that is, ppointer (Self) ^ is a pointer to the virtual method table (VMT.
PS: In a common method, self indicates the instance of the class, and in the class method, self indicates the class itself.