Listing 1

<cfcomponent displayname="Person" output="false"
        hint="I am a Person object">
    <!--- constructor method --->
    <cffunction name="init" access="public" output="false"
        returntype="Person" hint="Constructor for the Person CFC">
        <!--- arguments for the constructor; these are all optional
                so this can function as a no-arg constructor --->
        <cfargument name="firstName" type="string" required="false"
                default="" />
        <cfargument name="lastName" type="string" required="false"
                default="" />

        <!--- call the setters for firstName and lastName --->
        <cfscript>
            setFirstName(arguments.firstName);
            setLastName(arguments.lastName);
        </cfscript>

        <!--- return this object --->
        <cfreturn this />
    </cffunction>

    <!--- getters and setters (a.k.a. accessors and mutators) --->
    <cffunction name="getFirstName" access="public" output="false"
            returntype="string"
            hint="Returns this object's firstName">
        <cfreturn variables.firstName />
    </cffunction>

    <cffunction name="setFirstName" access="public" output="false"
            returntype="void" hint="Sets this object's firstName">
        <cfargument name="firstName" type="string" required="true" />

        <cfset variables.firstName = arguments.firstName />
    </cffunction>

    <cffunction name="getLastName" access="public" output="false"
            returntype="string" hint="Returns this object's lastName">
        <cfreturn variables.lastName />
    </cffunction>

    <cffunction name="setLastName" access="public" output="false"
            returntype="string" hint="Sets this object's lastName">
        <cfargument name="lastName" type="string" required="true" />

        <cfset variables.lastName = arguments.lastName />
    </cffunction>
</cfcomponent>