Skip to content

Instantly share code, notes, and snippets.

@rlbisbe

rlbisbe/traits.scala

Created Oct 13, 2015
Embed
What would you like to do?
abstract class Employee {
def salary: Int
}
trait InOffice {
def desk: String
}
trait Remote {
def location: String
def timeZone: String
}
trait Temporary {
def startDate: Int
def stay: Int
def endDate(): Int = (startDate + stay) % 12
}
trait Authority {
def directReports: Array[Employee]
def hasDirectReports() :Boolean = directReports.length != 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.