Reference types versus value types

We covered this topic in Chapter 3, Types and Type Casting, but it is important to emphasize that in most OOP languages, instances can be shared and objects can be passed around with their references. This is true for Swift classes and closures as well. In those cases, it is important to understand that the state of an object can be altered when objects are shared via references. In other words, if any user of a reference to a mutable object changes the object, all other users of that object will be affected by the change.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset