Skip to content

Instantly share code, notes, and snippets.

@adamcameron
Created August 17, 2021 20:40
Show Gist options
  • Save adamcameron/8b91d7c5d6a18d79c1a9ad0944c0d3b5 to your computer and use it in GitHub Desktop.
Save adamcameron/8b91d7c5d6a18d79c1a9ad0944c0d3b5 to your computer and use it in GitHub Desktop.
And even more... this time with a sub class
// Base.cfc
component {
writeOutput("Top of pseudo-constructor of #getMetadata(this).name#<br>")
exit;
writeOutput("Bottom of pseudo-constructor of #getMetadata(this).name#<br>")
function init() {
writeOutput("In #getMetadata(this).name#.#getFunctionCalledName()#<br>")
}
}
Top of testSub.cfm
Top of pseudo-constructor of test.exit.Base
Top of pseudo-constructor of test.exit.Sub
Bottom of pseudo-constructor of test.exit.Sub
In test.exit.Sub.INIT before super call
In test.exit.Sub.init
In test.exit.Sub.INIT after super call
Bottom of testSub.cfm
Top of testSub.cfm
Top of pseudo-constructor of nonWheelsTests.exit.function.Base
// Sub.cfc
component extends=Base {
writeOutput("Top of pseudo-constructor of #getMetadata(this).name#<br>")
//exit;
writeOutput("Bottom of pseudo-constructor of #getMetadata(this).name#<br>")
function init() {
writeOutput("In #getMetadata(this).name#.#getFunctionCalledName()# before super call<br>")
super.init()
writeOutput("In #getMetadata(this).name#.#getFunctionCalledName()# after super call<br>")
}
}
<cfoutput>
Top of #getFileFromPath(getCurrentTemplatePath())#<br>
<cfset base = new Sub()>
Bottom of #getFileFromPath(getCurrentTemplatePath())#<br>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment