Whatever message this page gives is out now! Go check it out!
<cfcomponent>
<cfset This.basesalary=40*20>
</cfcomponent><cfcomponent extends="employee">
<cfset This.mgrBonus=40*10>
</cfcomponent><cfcomponent extends="manager">
<cfset This.prezBonus=40*20>
</cfcomponent><cfobject name="empObj" component="employee">
<cfobject name="mgrObj" component="manager">
<cfobject name="prezObj" component="president">
<cfoutput>
An employee's salary is #empObj.basesalary# per week.<br>
A manager's salary is #mgrObj.basesalary + mgrObj.mgrBonus# per week.<br>
A president's salary is #prezObj.basesalary + prezObj.mgrBonus +
prezObj.PrezBonus# per week.
</cfoutput><cfcomponent>
<cffunction name="getPaid" returntype="numeric">
<cfset var salary=40*20>
<cfreturn salary>
</cffunction>
</cfcomponent><cfcomponent extends="employee">
<cffunction name="getPaid" returntype="numeric">
<cfset var salary=1.5 * Super.getPaid()>
<cfreturn salary>
</cffunction>
</cfcomponent><cfcomponent extends="manager">
<cffunction name="getPaid" returntype="numeric">
<cfset var salary=1.5 * Super.getPaid()>
<cfreturn salary>
</cffunction>
</cfcomponent><cfobject name="empObj" component="employee">
<cfobject name="mgrObj" component="manager">
<cfobject name="prezObj" component="president">
<cfoutput>
<cfoutput>
An employee earns #empObj.getPaid()#.<br>
A manager earns #mgrObj.getPaid()#.<br>
The president earns #prezObj.getPaid()#.
</cfoutput>
</cfoutput><!--- Create the component instance. --->
<cfobject component="appResources.components.tellTime2" name="tellTimeObj">
<!--- Invoke the methods. --->
<cfinvoke component="#tellTimeObj#" method="getLocalTime"
returnvariable="localTime" >
<cfinvoke component="#tellTimeObj#" method="getUTCTime"
returnvariable="UTCTime" >
<!--- Display the results. --->
<h3>Time Display Page</h3>
<cfoutput>
Server's Local Time: #localTime#<br>
Calculated UTC Time: #UTCTime#
</cfoutput><cfscript>
helloCFC = createObject("component", "appResources.components.catQuery");
helloCFC.getSaleItems();
</cfscript>http://localhost/appResources/components/catQuery.cfc?method=getSalesItems<cfobject name="Session.myShoppingCart" component="shoppingCart">| Type | Description |
private | Available only to the component that declares the method and any components that extend the component in which it is defined. This usage is like the Java protected keyword, not the Java private keyword. |
package | Available only to the component that declares the method, components that extend the component, or any other components in the package. A package consists of all components defined in a single directory. For more information on packages, see Using component packages in Using CFCs effectively . |
public | Available to any locally executing ColdFusion page or component method. |
remote | Available to a locally or remotely executing ColdFusion page or component method, or to a local or remote client through a URL, form submission, Flash Remoting, or as a web service. |
<cfcomponent>
<cffunction
name="deleteFile" access="remote" roles="admin,manager" output="no">
<cfargument name="filepath" required="yes">
<cffile action="DELETE" file=#arguments.filepath#>
</cffunction>
</cfcomponent><cffunction name="foo">
<cfif IsUserInRole("admin")>
do stuff allowed for admin
<cfelseif IsUserInRole("user")>
do stuff allowed for user
<cfelse>
<cfoutput>unauthorized access</cfoutput>
<cfabort>
</cfif>
</cffunction><!--- Create an instance of the component. --->
<cfobject component="tellTime" name="tellTimeObj">
<!--- Create a structure. --->
<cfset aboutcfc=structNew()>
<!--- Populate the structure with the metadata for the
tellTimeObj instance of the tellTime CFC. --->
<cfset aboutcfc=GetMetaData(tellTimeObj)>
<cfdump var="aboutcfc">