Yes, that is my experience. I don't understand why the duplicate would not
copy all the methods (functions). I think I'll look for some help on another
list and get back to yal if I find the answer.

Thanks


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Tom Woestman
Sent: Monday, November 08, 2004 10:08 AM
To: [EMAIL PROTECTED]
Subject: RE: Object Copy

Nate,

I suspect that the assignment new = oldObject just sets the 'new' variable
to point to the oldObject object and releases the newly created object to
garbage collection as the newly created object no longer has any references
pointing at it.

If the 'duplicate' functionality will not copy the CFC you may have to write
your own method to create a new instance of the CFC and copy all associated
data to the new object.

Hope this helps,
Tom Woestman
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 08, 2004 7:59 AM
To: [EMAIL PROTECTED]
Subject: Re: Object Copy

Have you tried creating a new object and then copying the information in the
original object into it with struct copy?

Or something like 

new = createObject("component", "myObject"); new = oldObject;

one wierd thing about components and functions in cfmx is that you can
actually reference functions as variables and move them between components.
really cool, but really wierd.

for example, if you have a method named "addNewRow()" - you can do something
like : 

myObj = createObject("component", "myObject"); tempVar =
myObject.myFunction; // notice its not myFunction() - no parens // now you
can dump the tempVar and you'll see it is actually a function <cfdump
var="#tempVar#">

Nate Nielsen
[EMAIL PROTECTED]


> 
> From: "Daniel Elmore" <[EMAIL PROTECTED]>
> Date: 2004/11/08 Mon AM 12:05:39 CST
> To: <[EMAIL PROTECTED]>
> Subject: Object Copy
> 
> What's the best way to make a deep copy of a created object, in this 
> case it's of a CFC. The object is cached in the application scope 
> after the "constructor" is called and is used throughout the 
> application. However there are some pages where I need to change some 
> of the default values that were passed into the Init function, so I 
> want to copy it to the request scope. I can't tell what the duplicate 
> function is doing, but it doesn't copy all the methods. I would have
thought duplicate is the answer.
> 
> Thanks!
> Daniel
> 
> ----------------------------------------------------------
> To post, send email to [EMAIL PROTECTED] To unsubscribe:
>    http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> To subscribe: 
>    http://www.dfwcfug.org/form_MemberRegistration.cfm
> 
> 
> 

----------------------------------------------------------
To post, send email to [EMAIL PROTECTED]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm

----------------------------------------------------------
To post, send email to [EMAIL PROTECTED]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm



----------------------------------------------------------
To post, send email to [EMAIL PROTECTED]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm


Reply via email to