Skip to content

Instantly share code, notes, and snippets.

@HDBandit
Created July 24, 2016 11:31
Show Gist options
  • Save HDBandit/6f1a055495f552c92175648342245c0d to your computer and use it in GitHub Desktop.
Save HDBandit/6f1a055495f552c92175648342245c0d to your computer and use it in GitHub Desktop.
object Color {
def create(r: Int, g: Int, b: Int): Color = {
new Color(r, g, b)
}
}
class Color(r: Int, g: Int, b: Int) {
def unary_! = {
new Color(255-r, 255-g, 255-b)
}
def getR() : Int = r
def getG() : Int = g
def getB() : Int = b
override def toString(): String = s"r: $r, g: $g, b: $b"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment