scala override

341 ワード

/**
 * Created by HongxueYu on 2014/9/26.
 */
class ComplexCom(real: Double, imaginary: Double){
    def re = real
    def im = imaginary
    override def toString() =
      "" + re + (if (im < 0) "" else "+") + im + "i"
}