Yes but what you've described doesn't copy the object, it just returns a new
object...

To copy the object, surely you have to take all of the variables in the
unnamed scope and set those variables in the new object and then return it.

Paul

> > 
> > <cffunction name="copyme">
> >     <cfreturn duplicate(this)>
> > </cffunction>
> 
> No. Duplicate will not work. What I mean is, assume your cfc 
> has one property, name:
> 
> <cffunction name="copyme">
>       <cfset var newI = createObject("component","this guys name")>
>       <cfset newI.setName(getName())>
>       <cfreturn newI>
> </cffunction>
> 
> > Also, is it possible to dynamically define a return type so
> > that you could (for example) have a base CFC that includes 
> > the copyme() functionality and is then extended by other 
> > components, but has the return type of "this CFC type", 
> > something like:
> > returntype="#getmetadata(this).name#"
> > 
> 
> I believe that will return an error.... however, remember that if A
> extends B, and AA extends B, both A and AA are a kind of B. In other
> words, both a poodle and a hound are types of dogs. So, if your copyme
> method has a returnType of "dog" and you return a poodle, it will work
> just fine. Of course, the opposite would not be true, since it is
> possible a dog is not a poodle.
> 
> ==============================================================
> ==========
> ===
> 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 
> 
> ----------------------------------------------------------
> 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