Avatar
vicktorManuel 10/19/2018 6:29 PM
This code creates two classes, Address and Person, and it creates two instances to represent Ray and Brian. class Address { var fullAddress: String var city: String init(fullAddress: String, city: String) { self.fullAddress = fullAddress self.city = city } } class Person { var name: String var address: Address init(name: String, address: Address) { self.name = name self.address = address } } var headquarters = Address(fullAddress: "123 Tutorial Street", city: "Appletown") var ray = Person(name: "Ray", address: headquarters) var brian = Person(name: "Brian", address: headquarters)` Suppose Brian moves to the new building across the street, so you update his record like this: brian.address.fullAddress = "148 Tutorial Street" What's going on here? What's wrong with this?