Ok, so in your example, Invoice "has-a" Ordering Person, how do I set
FirstName?
Invoice.OrderingPerson.setFirst("Sean"); ?????
Will this automatically go to Person.cfc and execute setFirst method?
Andy
-----Original Message-----
From: Sean A Corfield [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 12:39 AM
To: CF-Talk
Subject: Re: CFC Question
On Thursday, Jan 30, 2003, at 21:58 US/Pacific, Andy Ousterhout wrote:
> OK, I am hooked after only a few hours on CFC's. This is so much
> easier to
> code that what I was trying to do with modules & includes in 5.0....
:)
> For the sake of discussion, lets also say I have another component
> called
> Invoice that needs two Person objects, one for Ordering Person and
> another
> for Ship To person. I can't just use extends because that creates a
> single
> person instance. How do I code this?
"extends" represents an "is-a" relationship:
car "is-a" vehicle
so
<!--- car.cfc --->
<cfcomponent extends="vehicle">
...
</cfcomponent>
is a reasonable model.
"has-a" is modeled by 'containment' - having data members:
Invoice "has-a" Ordering Person
Invoice "has-a" ShipTo Person
so
<!--- 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>
Hope that helps?
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