Last active
August 29, 2015 14:20
-
-
Save displague/2f8e352fe4e851c02924 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Child.cfc ---> | |
<cfcomponent extends="Parent"> | |
<!--- No init method here. Inherits from Parent.cfc ---> | |
</cfcomponent> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Grandparent.cfc ---> | |
<cfcomponent> | |
<cfset variables.name = ""> | |
<cffunction name="init"> | |
<cfreturn this/> | |
</cffunction> | |
<cffunction name="getName"> | |
<cfreturn variables.name> | |
</cffunction> | |
</cfcomponent> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Parent.cfc ---> | |
<cfcomponent extends="Grandparent"> | |
<cffunction name="init"> | |
<cfargument name="name" required="true" type="string"> | |
<cfset variables.name = arguments.name> | |
<cfreturn super.init()/> | |
</cffunction> | |
</cfcomponent> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Then, call the init function on Child passing in a name: | |
<!--- | |
Calling init on Child should pass "name" to Parent.cfc | |
In CF11 Update 5 this throws an exception. | |
In CF11 Update 4 (and CF9) this executes without error. | |
---> | |
<cfset child = createObject("component", "Child").init(name = "Fred Flinstone")> | |
<cfoutput>#child.getName()#</cfoutput> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment