You can chain your CFC methods as follows:
emp=new employee();
emp.setFirstName("Tom").setLastName("Nash").setAge("30");
Chaining works only
The chain in the example works only until lastName. This is because setter for age is set to false:
<cfcomponent accessors="TRUE"> <cfproperty name="firstname" type="string" setter="true"/> <cfproperty name="lastname" type="string" setter="true"/> <cfproperty name="age" type="numeric" setter="false"/> <cffunction name="init"> <cfreturn this> </cffunction> </cfcomponent>
Sign in to your account