Programming, Scala, Data Type, Abstraction, Introduction.
members for your operations. But there is a perfect opportunity to abstract away another layer. All the operations themselves can be written as methods of the class class Rational(x: Int, y:Int) { def numerator :Int = x def denominator :Int = y def add(r: Rational) = new Rational(numerator *