<!--- super.cfc --->
<cfcomponent name="Super">
  <cffunction name="functionA()" returntype="string">
                <cfreturn functionB()>
        </cffunction>
</cfcomponent>

<!--- sub.cfc --->
<cfcomponent name="Sub" extends="Super">
        <cffunction name="functionB()" returntype="string" access="public">
                <cfreturn "Hello, World">
        </cffunction> 
</cfcomponent>

<!--- test1.cfm --->
<cfset super = createObject("Component", "Super")>
<cfoutput>#super.functionA()#</cfoutput>

<!--- test2.cfm --->
<cfset super = createObject("Component", "Super")>
<cfoutput>#super.functionB()#</cfoutput>

Neither of these tests should work. They didn't work for me. 

A supertype should not need to call a function in a subtype. If that's
really the case you should "pull up" the function from the subtype to
the supertype.

This will work:

<!--- super.cfc --->
<cfcomponent name="Super">
  <cffunction name="functionA()" returntype="string">
     <cfreturn functionB()>
  </cffunction>
  <cffunction name="functionB()" returntype="string" access="public">
     <cfreturn "Hello, World">
  </cffunction> 
</cfcomponent>

<!--- sub.cfc --->
<cfcomponent name="Sub" extends="Super">
  <cffunction name="functionC()" returntype="string" access="public">
    <!--- since I extend Super I inherit functionB() and can use it ---> 
    <cfreturn functionB()>
  </cffunction> 

</cfcomponent>

HTH,

Patrick

-- 
Patrick McElhaney
704.560.9117
http://pmcelhaney.blogspot.com
I still have 5 gmail invites.
----------------------------------------------------------
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 
[EMAIL PROTECTED]

Reply via email to