Created
May 19, 2020 11:51
-
-
Save haoyu-c/074b55236a98136cff37fc388639ccd6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
let name: String | |
init(name: String) { self.name = name } | |
var apartment: Apartment? | |
} | |
class Apartment { | |
let unit: String | |
init(unit: String) { self.unit = unit } | |
weak var tenant: Person? | |
} | |
var john = Person(name: "John Appleseed") | |
var unit4A = Apartment(unit: "4A") | |
john.apartment = unit4A | |
unit4A.tenant = john |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment