[Gambas-user] Collection as property?

Tobias Boege taboege at gmail.com
Sun Nov 24 21:26:25 CET 2019


On Sun, 24 Nov 2019, Jussi Lahtinen wrote:
> No, that is the easy part. I mean the _write. How to deal with .remove,
> .add, etc?
> 

By "dealing with it" I assumed you mean "forbid" it. What do you mean?

If that's the case, just make another copy of the collection that is
assigned to your property in _Write, and give out only copies of that
internal copy. That way, nobody except the object itself can hold a
reference to the collection inside your object and modifications from
the outside are not possible.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list