As per the accepted answer in thread Using implicit objects within classes
if implicit objects are encapsulated within companion object of a generic type then there is no need to explicitly import properties and behaviour from object.
With that logic I am not able to understand why is below code not getting compiled after removing import num._
implicit class GenericMedian[T: Numeric](seq: Seq[T]) {
def median(): Double = {
val num: Numeric[T] = implicitly[Numeric[T]]
import num._
val medianPosition = seq.length / 2
seq.sortWith(gt) match {
case x if x.length % 2 != 0 => x(medianPosition).toDouble()
case x => (x(medianPosition).toDouble() + x(medianPosition - 1).toDouble()) / 2
}
}
}
Can someone throw some light on this concept?