Talk:Immutable object
there is an error: ImmutableCart is immutable only if elements of the list are themselves immutable. Otheriwse, you copy the list allright, but you share the elements with the caller, so he can mutate them as he pleases. — Preceding unsigned comment added by 128.30.84.40 (talk) 18:40, 19 November 2005
- I disagree. It depends on what you consider part of the "ImmutableCart" object. I consider an "ImmutableCart" object to contain only its fields, i.e. the reference "items". Under this definition, "ImmutableCart" is indeed immutable. --Spoon! 09:03, 18 March 2007 (UTC)
I changed all references to vector in the C++ example to std::vector, as the C++ example would presumably be in a header file and it is generally considered bad style to include a global using namespace directive in a header file. I think it's very important for code examples to exhibit good style even if that makes them a little more verbose. - Zixyer 02:24, 19 December 2005 (UTC)
why does defensive copying link to object (computer science) which has no information as to what "defensive copying" means probably a mistake, can somebody correct? --Alex 11:10, 30 December 2005 (UTC)
- I changed the defensive copy redirect to go to Object copy instead, which talks about defensive copying.Tim Dean 22:07, 31 December 2005 (UTC)