Created
July 24, 2016 11:31
-
-
Save HDBandit/6f1a055495f552c92175648342245c0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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