Skip to content

Instantly share code, notes, and snippets.

@scottashipp
Last active May 28, 2019 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottashipp/aea21a378575b59adab4 to your computer and use it in GitHub Desktop.
Save scottashipp/aea21a378575b59adab4 to your computer and use it in GitHub Desktop.
Example trait for stackable traits explanation at https://code.scottshipp.com/?p=1368
trait FivePercentBonus extends BuckooBucks {
abstract override def addBucks(amt: Int) = {
if(amt >= 500) {
val bonus = (0.05 * amt)
buckooBalance += amt
}
super.addBucks(amt)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment