-- In ColdFusion we can create objects in three ways as:
cfobject, createObject() and new().
-- The syntax for all three is as below:
<cfobject component=”componentName” name=”objectName”>
2.
<cfscript>
Variables.objectName
= CreateObject(“component”, “componentName”);
</cfscript>
3.
<cfscript>
Variables.objectName
= New componentName(param1, param2,…);
</cfscript>
The important thing to mention here is the first two
methods don’t give call to init() method automatically if not called explicitly,
whereas the last one looks for the existence of init() method in the component automatically
during object creation and if found then it calls it and returns as per the
returnvalue of init() method and if returntype is set to void then the object for the component is returned.
No comments:
Post a Comment