我想编写一个根据其类型参数而行为不同的函数.我想要的一个简单示例如下所示:
def f[Int] = "I'm an int" def f[Float] = "I'm a float" def f[Burger] = "You want fries with that?"
这可能在Scala中还是需要某种解决方法?
parameters types scala
parameters ×1
scala ×1
types ×1