getInt
in SpecializedClass
does not override the method in GeneralClass
. To be able to override, the function argument in SpecializedClass
should be contravariant and the return type to be co-variant. Which in your case is not.
So unless you have something in getInt
in SpecializedClass
which takes a type T :> java.lang.Double
and return type as T <: java.lang.Integer
, it will not override it.
For your question, actually I dont feel the need to have such a method as Scala compiler will implicitly convert Java double to Scala Double.