A constructor allows you to say:
When my object is created, do a bunch of crap.
Why would this be useful? Imagine if you wanted to know _when_ your CFC
was created. You could do this in the constructor:
<cfset instance = structNew()>
<cfset instance.bornOnDate = now()>
Another example. Your CFC makes heavy use of another CFC. Instead of
constantly creating a new instance of that cfc, you could do:
<cfset instance = structNew()>
<cfset instance.utilityCFC = createObject(...)>
Make sense?
========================================================================
===
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
(www.mindseye.com)
Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)
Email : [EMAIL PROTECTED]
Blog : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus
"My ally is the Force, and a powerful ally it is." - Yoda
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Tyler Silcox
> Sent: Thursday, July 24, 2003 12:01 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [CFCDev] CFC constructors
>
>
> > Dave said: "And what happens if Macromedia introduces a concept of a
> constructor that does not mimic what many developers are using now?"
>
> I was born and weaned on ColdFusion, so I'm not that aware of
> constructors. What functionality does a constructor provide
> that the Camden scope/constructor area doesn't? I've always
> thought of the constructor area as being another
> simplification by MM...?
>
> Tyler
>
> ----------------------------------------------------------
> 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).