I try to override my parametrized method in scala,
I have an abstract class like this :
abstract class Ranking[G <: AbstractGenome, MG <: MultiGoalLike] {
def operate(individuals :IndexedSeq [IndividualMG[G,MG]]):IndexedSeq [IndividualMG[G,MG]
}
I want two type of ranking which need decorated version of IndividualMG : IndividualMG[G,MG] with IDistance, and IndividualMG[G,MG] with IRank.
My IndividualMG class signature :
class IndividualMG[G <: AbstractGenome,MG <: MultiGoalLike] (val genome: G,val multiGoal:MG)
My two class for ranking :
class Ranking1 [G <: AbstractGenome, MG <: MultiGoalLike] extends Ranking[G,MG] {
override def operate(individuals :IndexedSeq [IndividualMG [G,MG] with IRanking])
:IndexedSeq [IndividualMG [G,MG] with IRanking]= {
return ...
}
class Ranking2 [G <: AbstractGenome, MG <: MultiGoalLike] extends Ranking[G,MG] {
override def operate(individuals :IndexedSeq [IndividualMG [G,MG] with IDistance])
:IndexedSeq [IndividualMG [G,MG] with IDistance] = {
return ...
}
I have an error, it’s logic because type differs when i try to override, but how can i make to verify inheritance type [I <: IndividualMG [G,MG]] for my two ranking operator in class Ranking1 and Ranking2 ?
Thanks stack,
SR.
What about