Oh gee...you can overrite methods too!  I didn't know that.  Hmmm...sorry to bug you 
guys with obvious stuff now, I'm just digging into this deeper now.

Set test.cfm to
<cfscript> 

        myobj = CreateObject("Component", "test");
        
        goo = myobj.foo();
        WriteOutput(goo);
        WriteOutput("<br />");
        function myFoo()
        {
                return "anothergooey";
        }
        
        myobj.foo = myFoo;
        
        goo = myobj.foo();
        WriteOutput(goo);
        
</cfscript>

and test.cfc to
<cfcomponent>   
        <cffunction name="foo" access="public" returntype="string">
                <cfreturn "gooey" />
        </cffunction>

</cfcomponent>

Doug

>-----Original Message-----
>From: Ian Skinner [mailto:[EMAIL PROTECTED]
>Sent: Friday, September 19, 2003 5:42 PM
>To: '[EMAIL PROTECTED]'
>Subject: RE: [CFCDev] setting cfc vars etc not defined in a cfc?
>
>
>I ran across this same behavior, and I was told it was "By 
>Design" when I
>asked about it.  When you create on object by institating(sp?) 
>a CFC, new
>variable value pairs can be added to this object's unnamed scope
>pragmatically, just as they can be added to any other scope in 
>ColdFusion
>(session.t=6 for example).  So the statement myobj.t = 6 will create a
>variable in the object and give it a value.  You can even 
>write a function
>that will use the value, if you like. 
>
>I thought this was rather unusual myself and I don't know if it can be
>prevented or not.
>
>--------------
>Ian Skinner
>Web Programmer
>BloodSource
>www.BloodSource.org
>Sacramento, CA
>
>
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: Friday, September 19, 2003 2:34 PM
>> To: [EMAIL PROTECTED]
>> Subject: [CFCDev] setting cfc vars etc not defined in a cfc?
>> 
>> 
>> Ok, playing around with stuff this afternoon.  I created an 
>> 'empty' cfc named test.cfc, its empty for no good reason just 
>> a proof of concept
>> <cfcomponent>
>> 
>>      <!--- empty --->
>> 
>> </cfcomponent>
>> 
>> Now I created test.cfm
>> <cfscript> 
>> 
>>      myobj = CreateObject("Component", "test");
>>      myobj.t=6;  
>>      WriteOutput('t= ' & myobj.t);
>> </cfscript>
>> 
>> When I call test.cfm from ze browser I get no error. In fact 
>> I get t= 6 output to the browser.  Now in Java, etc... this 
>> would bomb out.  How can I programatically keep this from 
>> occuring?  Or can I?  Am I missing something here?  
>> 
>> Doug
>> 
>> ---->dugOUT   ��� 
>> "When I was kidnapped, my parents snapped into action.  They 
>> rented out my room." -- Woody Allen
>> 
>> ----------------------------------------------------------
>> 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).
>> 
>> An archive of the CFCDev list is available at 
>www.mail-archive.com/[EMAIL PROTECTED]
>----------------------------------------------------------
>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).
>
>An archive of the CFCDev list is available at 
>www.mail-archive.com/[EMAIL PROTECTED]
>
----------------------------------------------------------
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).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to