×

Discussion Board

Results 1 to 3 of 3

Thread: Code question

  1. #1
    Registered User
    Join Date
    Dec 2003
    Location
    Thailand
    Posts
    32

    Code question

    I try to search this from all documents I had but not found.
    Here are my question

    HelloScreen(HelloWorldMIDlet midlet, String string)
    {
    super("HelloWorldMIDlet", string, 256, 0);
    this.midlet = midlet; <- what is this? where it's document?
    exitCommand = new Command("Exit", Command.EXIT, 1);
    addCommand(exitCommand);
    setCommandListener(this);
    }

  2. #2
    Registered User
    Join Date
    Mar 2004
    Posts
    16
    I think "this" refer to the current object !

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Switzerland
    Posts
    78
    Correct. "this" is the current object.

    So in your example someone defined a variable like:

    private Midlet midlet;

    and then in the constructor have a variable with the same name.

    Again, why it makes sense to define member variables with m_ So the code would have been

    m_Midlet = midlet;

    Cheers,
    Sam

Posting Permissions

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