Guest User

Untitled

a guest
Nov 16th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. func main_old()
  2. {
  3. // cannot construct database directly
  4. //let mydb = SingletonDatabase()
  5.  
  6. let db = SingletonDatabase.instance
  7. var city = "Tokyo"
  8. print("\(city) has population \(db.getPopulation(name: city))")
  9.  
  10. let db2 = SingletonDatabase.instance
  11. city = "Manila"
  12. print("\(city) has population \(db.getPopulation(name: city))")
  13. print("SingletonDatabase has \(SingletonDatabase.instanceCount) instance(s)")
  14. }
Add Comment
Please, Sign In to add comment