Results 1 to 3 of 3

Thread: How to get current instance of class?

  1. #1

    How to get current instance of class?

    Another noob question: Basically I'm looking into equivalent of 'this' Java keyword - way to get current instance of class.

  2. #2
    In pascal you use self for accesing object instance to which current code belongs.

    Also if you need to interact with same object several times in a row you can use:
    Code:
    with SomeObject do
    begin
    ....
    end;
    So calling this:
    Code:
    with Form1 do
    begin
      Width := 640;
      Height := 480;
      Color := clWhite;
    end;
    is same as calling this:
    Code:
    Form1.Width := 640;
    Form1.Height := 480;
    Form1.Color := clWhite;

  3. #3
    'this' inside a class method is 'self'

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •