Delphi class reference

Source: Internet
Author: User

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:

  1. Tclass = Class of type;
  2. // Example
  3. Tclass = Class of tobject;

The tobject class type is as follows:

  1. Function tobject. classtype: tclass;
  2. Begin
  3. Pointer (result): = ppointer (Self) ^;
  4. 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.

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.