That is the definition yep :-) but take this for example...... Say I
wanted to cookup a new 'object' of a ColdFusion Coder.... of course the
coder could be a human yes?
So we have 1 class - a superclass called human.cfc which looks like :
<cfcomponent name="human">
<cffunction name="createhuman" returntype="struct" access="package">
<cfargument name="fname" default="" type="string">
<cfargument name="lname" default="" type="string">
<cfargument name="age" default="-1" type="numeric">
<cfscript>
this.fname = arguments.fname;
this.lname = arguments.lname;
this.age = arguments.age;
</cfscript>
<cfreturn this>
</cffunction>
</cfcomponent>
We also have a CFC named coder .cfc which is extending/inheriting the
human.cfc method & properties..
<cfcomponent name="coder" extends="human">
<cffunction name="create" returntype="struct">
<cfargument name="language" default="" type="string">
<cfscript>
createhuman(argumentCollection=duplicate(arguments));
</cfscript>
<cfset this.language = arguments.language>
<cfreturn this>
</cffunction>
</cfcomponent>
we can now call this <cfcomponent name="coder" extends="human">
<cffunction name="create" returntype="struct">
<cfargument name="language" default="" type="string">
<cfscript>
createhuman(argumentCollection=duplicate(arguments));
</cfscript>
<cfset this.language = arguments.language>
<cfreturn this>
</cffunction>
</cfcomponent>
We can either now, call human.cfc to create a simple human with default
params, or we can call the coder.cfc to add instance variables to
human.cfc thus :
<cfset stArgs = structNew()>
<cfset stArgs.fname = "Neil">
<cfset stArgs.lname = "Clark">
<cfset stArgs.age = 29>
<cfset stArgs.language = "ColdFusion">
<cfinvoke component="com.macromedia.coder" method="create"
argumentcollection="#stArgs#" returnvariable="coder" />
<cfoutput>#coder.lname#, #coder.fname#, #coder.age#</cfoutput>
This is inheritance in the ColdFusion CFC vain - yes it may not be what
you determine as true inheritance, but its ingeritance nonetheless.
Though I concuse with you of the dict definition, but I still think
CFC's can still be OOP.
Neil
Neil Clark
Team Macromedia
http://www.macromedia.com/go/team
Announcing Macromedia MX!!
--------------------------
http://www.macromedia.com/software/trial/.
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists