parent component’s sample init method
<cffunction name="init" output="false" access="public" returntype="NavigationBase">
<cfset this.index = 0 />
<cfset this.length = 0 />
<cfset this.current = "" />
<cfreturn this />
</cffunction>
.
.
.
child component sample code
<cfcomponent displayname="Navigation" output="false" extends="NavigationBase">
<cffunction name="init" output="false" access="public" returntype="Navigation">
<cfreturn this/>
</cffunction>
.
.
And if i instanciate the child component, the variables defined in parent’s init function are always undefined. What I am doing here wrong?
Thanks
The
init()of the child overrides the parentinit()method, so the variables are not getting defined anywhere. Add this line to your childinitto run the parent
initand define/initialize those variables.