On Mon, 3 Jan 2005 22:25:49 -0500, Brian Kotek <[EMAIL PROTECTED]> wrote:
> Back to the idea of using instance variables vs. using getter methods
> within the CFC, keep in mind that if the getter method returns an
> instance variable that is an array, you're getting a pass-by-value
> copy of the array and not a reference to the original array. This can
> lead to some bizarre things if you aren't aware of it, like trying to
> modify the array returned by the getter but the actual instance
> variable doesn't change.

Yup and sort of conversely, if you return a struct remember that it is
by reference so if you do:

obj.getFoo().bar = 3;

you will overwrite the foo.bar inside the object.

Just stuff you need to think about with OO (not a CF issue really
since similar issues exist in Java, C++ etc). How encapsulated does
your object need to be in terms of what it hands out to 'client' code?
-- 
Sean A Corfield -- http://www.corfield.org/
Team Fusebox -- http://www.fusebox.org/
Breeze Me! -- http://www.corfield.org/breezeme
Got Gmail? -- I have 6 invites to give away!

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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - RUWebby
http://www.ruwebby.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189218
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to