我有一个实现一种方法的抽象类。
如何访问参数internalValue
(由抽象类构造函数设置?)
abstract class Value(internalValue:Int) {
def equal( v:Value ): Boolean
def notEqual( v:Value ): Boolean = {
//here I get an error on v.internalValue:
//"value internalValue is not a member of Value"
(internalValue != v.internalValue)
}
}
case class Value1(internalValue:Int) extends Value(internalValue){
def equal( v:Value1 ): Boolean = {
//this works correctly
(internalValue == v.internalValue)
}
}
谢谢你。