Scala方法需要具有多重继承的参数模板

Scala方法需要具有多重继承的参数模板,scala,templates,inheritance,Scala,Templates,Inheritance,我知道JAVA允许生成通用方法,如(见): public void yellAtPet(T arg){ arg.大叫(“不要去那里!”); arg.pet(“好孩子”); } 我希望在scala中也能做到这一点,例如: def addWorkers[T <: BuiltInfrastructure & TraitBuiltRecruter](bi : T, nbre : n){ // do somthing } def addWorkers[T def addWor

我知道JAVA允许生成通用方法,如(见):

public void yellAtPet(T arg){
arg.大叫(“不要去那里!”);
arg.pet(“好孩子”);
}
我希望在scala中也能做到这一点,例如:

 def addWorkers[T <: BuiltInfrastructure & TraitBuiltRecruter](bi : T, nbre : n){
   // do somthing
 }
def addWorkers[T
 def addWorkers[T <: BuiltInfrastructure & TraitBuiltRecruter](bi : T, nbre : n){
   // do somthing
 }
def addWorkers[T <: BuiltInfrastructure with TraitBuiltRecruter](bi : T, nbre : n)
def addWorkers(bi: BuiltInfrastructure with TraitBuiltRecruter, nbre : n)