View Single Post
Posts: 124 | Thanked: 10 times | Joined on Jan 2007 @ Italy
#13
Originally Posted by Venemo View Post
No. Don't get confused with this.
When you append an item to a collection in such a way, or assign it to a variable, it gets copied. (Its copy constructor or operator= gets called.)

Eg.
Code:
MyClass item; //creating a new item
item.stuff = 42;
MyClass item2 = item; //behind the scenes, item2 copies item
item.stuff = 8; //this line doesn't change item2
even when i get from collection?!

ok that's the point, i've a list of Service in my main classes. i've to share this list with other classes, like "EditService". how can i pass list, or elements, to other class in order to make them change original list?!

with the old list of pointer it worked well(they actually changed value of original list), but as u said save pointer doesn't make sense. so what i'm supposed to do?!

back with pointer list changing saving function?! or there are other solutions!?