On Monday, Oct 6, 2003, at 07:51 US/Pacific, Dave Carabetta wrote:
Is it possible to extend multiple components with one component? Is so, how?

No it is not possible.


In CF (and JAVA), there is only single inheritance. However, with CF, you can add methods to the /WEB-INF/cftags/component.cfc and all your application CFCs will inherit from it as well as any super class you may specify in your CFC (think java.lang.Object, which all JAVA classes automatically inherit from).

That's a bit misleading... your application CFC inherits only from the CFC it extends. The key is that any CFC that does not explicitly extend another CFC is treating as if it says extends="WEB-INF.cftags.component". Your applications CFCs do not "inherit from it as well" - it's the super class itself which inherits from the component.cfc (assuming the super class has no extends= attribute).


The bottom line is that inheritance is overused: composition is more often correct. Inheritance means "is-a" and such relationships are relatively rare in the real world in comparison to composition ("has-a").

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

----------------------------------------------------------
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