"this" lets you refer to a runtime object during design time. For
example, let's say we have a method in Student that lets them sign up
for a course. When they sign up, we want to pass a reference to that
Student object to the course. How do we refer to "that" student, since
there may be many individual Student objects? That's what "this" gives
you:



public class Student{

public void signup(Course aCourse){
  aCourse.enroll(this);
}

}

Then, we have...

Student joe = new Student();
joe.signup(new Course('Java for ColdFusion Programmers'));

So, in that case, "this" refers to joe.

Hal Helms
"Java for CF Programmers" class 
in Las Vegas, August 18-22
www.halhelms.com

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Dave Carabetta
Sent: Thursday, July 24, 2003 4:17 PM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] CFC constructors


>No it isn't.
>
>The code between CFCOMPONENT tags outside CFFUNCTION is NOT A SCOPE AT
>ALL!!
>
>(except in the lexical sense - don't get me started)
>
>Variables have scopes. You're talking about a region of code which has
>nothing to do with scopes in ColdFusion.
>

Yeah, Ray corrected me on that one.

>>and is the only true private scope (contrary to some posts on cf-talk
and 
>>elsewhere, the "this" scope is not private as in Java).
>
>"this" is NOT a scope in Java.

It isn't? What is it then? I mean, I know that it's a way reference 
attributes/methods inside the object, but what is it technically
referred to 
as? Just curious.

Regards,
Dave.

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to