Created
August 5, 2015 18:27
-
-
Save adambyram/e9ad9f0a9b04cda23c3c 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
//: Playground - noun: a place where people can play | |
class Account: Hashable { | |
var accountID: String = "" | |
var hashValue: Int = 0 | |
} | |
func ==(lhs: Account, rhs: Account) -> Bool { | |
return lhs.accountID == rhs.accountID | |
} | |
class FooAccount: Account { | |
} | |
class BarAccount: Account { | |
} | |
let foo = FooAccount() | |
foo.accountID = "foo" | |
foo.hashValue = 1 | |
let bar = BarAccount() | |
bar.accountID = "bar" | |
bar.hashValue = 2 | |
var accounts = Set<Account>() | |
accounts.insert(foo) | |
accounts.insert(bar) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment