OK, in each case, what these things are doing, is they're doing, what sometimes gets referred to as operator overloading.
这将会是个默认的或者说是,通用的来比较对象是否相同的方法,好,在每个例子中,这些事情正在做的,就是,一些与操作符重载有关的东西。
The reason I say that is, by having operator overloading I can use 1 generic interface to all of the objects that I want to use.
他在大多数情况下都是对的,我要这么说的原因是,通过运算符重载我可以,用一个通用的借口对。
In which I said, you know, I didn't like the fact that things like plus are overloaded, because you can use plus to add strings, you can use plus to add numbers, you can use plus to add floats.
那个玩笑是这样的,你们懂得,我并不喜欢,加法被重载这样的事情,但是你可以用加法,来对字符串进行合并,你可以用加法来加数字。
So there are some downsides, in my view, to doing operator overloading, but there's some real pluses.
它还可以应用于其他一些东西,因此这样做操作符重载,就会产生一些负面影响了,以我的观点来看的话。
Because this is overloading that multiplication operator with two different tasks.
因为这会造成使得乘法操作符,对两种不同的任务造成重载。
One of the other things we showed last time is that operators are overloaded.
我们上次讲过的一个话题,是运算符的重载。
Now what I'd like to do, every time I find a divisor I'd like to gather it together. So I'm going to create a tuple of one element, the value of i.
那么我就会去创建只包含一个元素的元组,也就是这个除数了,然后,啊,很好,这里是加法重载的一个很糟糕的应用。
Especially in the presence of operator overload.
尤其是运算符重载,这种情况出现的时候。
应用推荐