Skip to content

Instantly share code, notes, and snippets.

@epost
Created November 19, 2015 14:38
Show Gist options
  • Save epost/7fd7ce4919430c512ef2 to your computer and use it in GitHub Desktop.
Save epost/7fd7ce4919430c512ef2 to your computer and use it in GitHub Desktop.
marco-code-sessie-1-1212xx-geloof-ik
class Animal {
def makeSound() = "Hi! I weigh " + weight
val weight = 15.5
}
class Dog extends Animal {
override def makeSound() = "woof!"
override val weight = 2.0
}
class Cat extends Animal {
override def makeSound() = "meow!"
override val weight = 1.0
}
class Doberman extends Dog {
override def makeSound() = "GRRRRRRRRR WOOF WOOF! GRRRR!"
}
// --------------
class Scale {
val name = "some abstract scale"
val notes = List(0, 2, 4, 5, 7, 9, 11, 12)
def transpose(semitones: Int) = notes map (note => note+semitones)
override def toString = name + ": " + notes
}
class NaturalMinorScale extends Scale {
override val name = "natural minor"
override val notes = List(0, 2, 3, 5, 7, 8, 10, 12)
}
// ------------------
object Main extends App {
val a1 = new Animal
var i = 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment