Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func main_old()
- {
- // cannot construct database directly
- //let mydb = SingletonDatabase()
- let db = SingletonDatabase.instance
- var city = "Tokyo"
- print("\(city) has population \(db.getPopulation(name: city))")
- let db2 = SingletonDatabase.instance
- city = "Manila"
- print("\(city) has population \(db.getPopulation(name: city))")
- print("SingletonDatabase has \(SingletonDatabase.instanceCount) instance(s)")
- }
Add Comment
Please, Sign In to add comment