On Friday, Jan 31, 2003, at 05:52 US/Pacific, Andy Ousterhout wrote:
> Ok, so in your example, Invoice "has-a" Ordering Person, how do I set
> FirstName?
>
> Invoice.OrderingPerson.setFirst("Sean"); ?????

Not quite - see below.

>       <!--- invoice.cfc --->
>       <cfcomponent>
>               <cffunction name="create">
>                       <cfargument name="shipto" type="person">
>                       <cfargument name="orderer" type="person">
>                       <cfset this.shipto = arguments.shipto>
>                       <cfset this.orderer = arguments.orderer>
>               </cffunction>
>       </cfcomponent>

You use this as follows:

        <!--- create shipping person --->
        <cfset shiptoperson = createObject("component","person")>
        <cfset shiptoperson.setFirstName("Sean")>
        <!--- similarly, create an orderingperson --->
        <!--- set up invoice --->
        <cfset inv = createObject("component","invoice")>
        <cfset inv.create(shiptoperson,orderingperson)>

Or you can just use "this" scope to have publicly accessible data 
members:

        <cfset inv = createObject("component","invoice")>
        <cfset inv.shipto = createObject("component","person")>
        <cfset inv.shipto.setFirstName("Sean")>
        <cfset inv.orderer = createObject("component","person")>
        <cfset inv.orderer.setFirstName("Joe")>

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to