That darn stick, I knew I should have grabbed the other end. I suspected that something wasn't quite right in the method I was using when I couldn't figure it out,
Cheers guys, -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dave Watts Sent: 26 March 2005 01:03 To: [email protected] Subject: RE: [CFCDev] referencing a composite entities properties and methods (urgent, please help) > I have chosen the worst weekend to need a quick answer! Oh > well, please help I'm no OO expert, but I'll do what I can. > my question is, how do i reference the properties of the > database cfc, and the methods of the dao, from within the > vehicle cfc it self, and from outside of the cfc from the > controller Currently, you can't. All of those instance variables are private (as they probably should be). You will need to write public methods in each CFC to allow you to indirectly access those private properties. > Also, how do i reference the instance scope of the vehicle > cfc, from within the vehicle dao. Again, you can't. You can, however, pass them as arguments to the public methods you'll need to write, as described above. > Does a composition like this all share the same variables > (instance) scope? No, I don't think so. Each will have its own scope. > I realise that the above method also breaks encapsulation, so > would i pass in objects to the init method of the vehicle > cfc. Would this pass a reference to an object outside of > vehicle cfc or would the whole object be passed into the > vehicle cfc? I'm not sure exactly what you're asking here. However, if you pass CFC instances to a method of another CFC instance, I'm pretty sure they're passed by reference. That doesn't mean you'll necessarily be able to access these arguments from outside the CFC instance to which you pass them - you would have to associate them with a variable first if you want to do so. <!--- This foo instance can be addressed directly, or within oBar using whatever argument name it was given. ---> <cfset oFoo = CreateObject("component", "foo")> <cfset oBar = CreateObject("component", "bar").init(oFoo)> <!--- This foo instance can only be addressed within oBaz using the argument name it was given. ---> <cfset oBaz = CreateObject("component", "baz").init(CreateObject("component", "foo")> Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
