Created
October 28, 2014 11:30
-
-
Save tim-peterson/7cc576204e4620b01f7c to your computer and use it in GitHub Desktop.
thinkful 2
This file contains hidden or 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 Dog { | |
let name: String | |
let color: UIColor | |
init(name: String, color: UIColor) { | |
self.name = name | |
self.color = color | |
} | |
class func genus() -> String { | |
return "Canis" | |
} | |
func speak() { | |
println("Ruff!") | |
} | |
func sit() { | |
println("I'm \(name) and I'm sitting :)") | |
} | |
} | |
let genusOfDog = Dog.genus() | |
println("All dogs belong to the \(genusOfDog) genus.") | |
let white = UIColor.whiteColor() | |
let spunky = Dog(name: "Spunky", color: white) | |
spunky.speak() | |
spunky.sit() | |
let lightBrown = UIColor(hue: 0.1, saturation: 0.4, brightness: 0.8, alpha: 1) | |
let buddy = Dog(name: "Buddy", color: lightBrown) | |
buddy.speak() | |
buddy.sit() | |
println(buddy.name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment