>>> [EMAIL PROTECTED] 12/08/03 03:04AM >>>
> Another is that i'm beginning to see that inheritance is "nearly useless" in CF -
> well, that's a broad statement, but for the most part it's kinda true, because all
> that is inherited is the methods. The instance data isn't inherited, because it's
> only
> class inheritance, not object inheritance. So if you need the instance data in the
> subtypes, and you probably will, you still need to pass it down to the subtype using
> ... you got it, composition.
Component data (vars in the "Variables" scope) is inherited by "child" components. I
am using it to good effect in a Unit Testing system that I work with.
Inheritance isn't always "evil" or useless - you should just make sure it is the best
solution for your problem rather than jumping into it without much thought. There are
some situations where it provides a very elegant solution over other options.
<cfcomponent name="Parent" >
<cfset Variables.Name = "I'm an object in a family" >
</cfcomponent>
<cfcomponent name="Child" extends="Parent" >
<cffunction name="GetName" >
<cfreturn Variables.Name > // returns "I'm an object in a family"
</cffunction>
</cfcomponent>
Jon
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words '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]