Say that, for aesthetical reasons, I want to be able to write:
3 / 4
and have / be a method on a class that there exists an implicit conversion from Int to, e.g.:
class Foo(val i: Int) {
def /(that: Int) = // something
}
implicit def intToFoo(i: Int) = new Foo(i)
Is this at all possible, i.e. is it possible to "disable" the / method on Int?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…