CreateObject() - create a coldfusion object (type component)
CreateObject.cfm
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CreateObject function example: how to create a coldfusion object (type component)</title>
</head>
<body>
<h2 style="color:Crimson">CreateObject Function Example: Component</h2>
<cfset MyObject=CreateObject("component","MyComponent")>
<cfoutput>
<b>MyObject.Sum(10,25):</b> #MyObject.Sum(10,25)#
<br /><br />
</cfoutput>
<cfdump var="#GetMetaData(MyObject)#" label="MyObject" >
</body>
</html>
MyComponent.cfc
<cfcomponent output="no" Author="Jones" displayname="Math">
<cffunction name="Sum" access="remote" returntype="numeric" description="Sum two numbers">
<cfargument name="Value1" type="numeric" required="yes">
<cfargument name="Value2" type="numeric" required="yes">
<cfset Sum=arguments.value1+arguments.value2>
<cfreturn Sum>
</cffunction>
</cfcomponent>
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjitQAe49IVWYVZp_AaC5MU_H5zRw87ZC1OaxlSYrttx4Kp4rFmEj6nbV8xPqwdFR2RVMiqcBw1Xip7nmpdcKQeJRqnkYao-7g2NuarXUdtWhMtCcVv7WpcCkIwkfjypwya5-8Dk3mt8qg/s1600/CreateObject.gif)
- Decrypt() - decrypt a string that is encrypted using a standard encryption technique
- GetComponentMetaData() - get meta data for a cfc
- DE() - escape any double-quotation marks in the parameter and wraps the result in double-quotation marks
- Evaluate() - evaluate one or more string expressions dynamically from left to right
- SetVariable() - set a variable with name and value