Copy link to clipboard
Copied
Hi,
Is there the way to call the function from other cfc?
From cfc.message, how can i call the method "getuser" from user.cfc
<cfcomponent name="user">
<cffunction name="getuser">
</cffunction>
</cfcomponent>
<cfcomponent name="message">
<cffunction name="get_message">
</cffunction>
</cfcomponent>
Thanks
Copy link to clipboard
Copied
Do it the same way you would call it from a .cfm file.
Copy link to clipboard
Copied
Strictly speaking, you don't call a function except you're inside the CFC containing the function. From elsewhere, you have to call the function on an object. Hence, first create an instance of the CFC, then call the function on that object.