emp = new emp(); => emp = new employee();
writeOutput("last Name = " & emp.emp.lastname & "<br>"); => writeOutput("last Name = " & emp.lastname & "<br>");
<cfproperty name="lastname" type="string" setter="false"/> => <cfproperty name="lastname" type="string" setter="true"/>
CFC Implicit notation works only if you set both invokeImplicitAccessor in the Application.cfc and accessors in the component to true. Only setting up invokeImplicitAccessor to true sets values to the This scope of the component as same as when it's not defined.
For example, this will give you the error "Element FIRSTNAME is undefined in VARIABLES" because FIRSTNAME is defined in the THIS scope instead of VARIABLES.
this.name = "MyApplication";
this.invokeImplicitAccessor = true;
<cfproperty name="firstname" type="string">
emp = new employee();
emp.firstname = "Tom"; // The scope of firstname is THIS, not VARIABLES.
writeOutput("First Name = " & emp.getFirstname()); // This generates the error.
In order to fix the error above, replace <cfcomponent> in employee.cfc with <cfcomponent accessors="true"> so that the scope of firstname would be VARIABLES.
Europe, Middle East and Africa