🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.java
Article #1014

Re: the this reference

#1014
From: Tony F. White
Date: Thu, 02 Sep 1999 00:00
34 lines
1396 bytes
basically it is a way to access the current class you are using from within
it without knowing to name

this is a bit of sample code describing a simple class

class Coordinates extends Object {
  protected int x_coord, y_coord;                   // The preferred size.

  public Coordiantes( int x, int y) {
    this.x_coord = x;
    this.y_coord = y;
    }
}

so when you create an object  using it eg
Coordinates position = new Coordinates(12,15);

postion.x_coord will equal 12
and position.y_coord will equal 15

you can do many other things with it this is just a fairly basic example

VrLife <vrlife@alienbase.mil> wrote in message
news:37cd1e7e.2233848@news.primus.com.au...
> hi:
> can some one please explain to me the concept of 'this' as a
> reference, i had read the book so many times and still can't quite
> get it
>
> tks!
> vin
>
>
Technical Details
Message-ID: <7qltj1$p8f$1@bunyip.cc.uq.edu.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37cd1e7e.2233848@news.primus.com.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d6db,ba41d80c6911d23f
X-Google-Attributes: gid10d6db,public
From: "Tony F. White" <tfwhite@bigfoot.com>
Subject: Re: the this reference
Date: 1999/09/02
Message-ID: <7qltj1$p8f$1@bunyip.cc.uq.edu.au>
X-Deja-AN: 520152093
References: <37cd1e7e.2233848@news.primus.com.au>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: University of Queensland
X-MSMail-Priority: Normal
Newsgroups: aus.computers.java