I have a simple class calc that squares and cubes the input:
object calc2 {
def square(nmr: Int) = {
calc.square(nmr)
}
def cube(nmr: Int) = {
calc.cube(nmr)
}
def square(nmr: Double) = {
calc.square(nmr)
}
def cube(nmr: Double) = {
calc.cube(nmr)
}
}
And I'm using a Scala Worksheet in Eclipse with calls to this object:
object test {
calc2.square(3) //> res0: <error> = 9.0
calc2.cube(3) //> res1: <error> = 27.0
calc2.square(3.0) //> res2: <error> = 9.0
calc2.cube(3.0) //> res3: <error> = 27.0
}
However I get a error in the Editor for every line which says
value square is not a member of object exercises2.calc2
As you can see the worksheet seems to do the calculation. So why am I getting this error?