Created
March 13, 2017 10:16
-
-
Save shabib87/e920c4f053a659f4c57cbaf2f9bca751 to your computer and use it in GitHub Desktop.
In support to blog post
This file contains 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 | |
} | |
deinit { | |
print("\(name) is being deinitialized") | |
} | |
} | |
class Apartment { | |
let number: Int | |
var person: Person? | |
init(number: Int) { | |
self.number = number | |
} | |
deinit { | |
print("Apartment \(number) is being deinitialized") | |
} | |
} | |
var person: Person? = Person(name: "John Doe") | |
var apartment: Apartment? = Apartment(number: 123) | |
apartment.person = person | |
person = nil | |
// output: | |
// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment