Last active
March 8, 2016 08:30
-
-
Save jongwonwoo/deacf594772f47aa32a0 to your computer and use it in GitHub Desktop.
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 Country { | |
let name:String | |
var capitalCity:City? | |
init (name:String, capitalName:String) { | |
self.name = name | |
self.capitalCity = City(name: capitalName, country: self) | |
} | |
} | |
class City { | |
let name:String | |
unowned let country:Country | |
init (name:String, country:Country) { | |
self.name = name | |
self.country = country | |
} | |
} | |
var country = Country(name: "Korea", capitalName: "Seoul") | |
print("\(country.capitalCity!.name)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment