Skip to content

Instantly share code, notes, and snippets.

@zakki
Created September 3, 2015 06:59
Show Gist options
  • Save zakki/0c8ab72f9295923d8073 to your computer and use it in GitHub Desktop.
Save zakki/0c8ab72f9295923d8073 to your computer and use it in GitHub Desktop.
//http://codemonkeyism.com/how-to-improve-programming-with-interfaces/
case class Person(n:String) { def name():String = n }
type Nameable = { def name():String }
def printName(n:Nameable) { println(n.name) }
printName(new Person("Codemonkey"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment