更一致的、对称的操作符重载。
与其外表相反,这并非操作符重载。
And no, contrary to what it might look like, this isn't operator-overloading.
这是我第一次被介绍给了操作符重载的概念。
That was the first time I was introduced to the concept of operator overloading.
在清单2中,可以看到我在清单1中设置的操作符重载的效果。
In Listing 2, you can see the operator overloading I set up in Listing 1 in action.
在下一章我们将进一步学习操作符重载,本章中我们先介绍赋值操作符。
We'll learn more about operator overloading in the next chapter, but in this chapter we cover the assignment operator.
操作符重载不工作对一些东西,为别人工作…链接器错误LNK2019。
Operator overloading does not work for some stuff, works for others... linker error lnk2019.
面向对象语言,更提供了操作符重载,使得类函数能方便的使用系统内部的操作符。
The object oriented language, the more provides operators overloaded, which groups can use function inside the system operators.
可以看到,操作符的即时多态,或操作符重载,对于我们来说,如果小心使用和记录,会非常强大。
As you've seen, operator AD hoc polymorphism, or operator overloading to the rest of us, can be quite powerful if carefully employed and documented.
我记得在采访Gosling时曾问过他为何放弃操作符重载(我想该问题和答案还尚未公开过)。
I remember asking this Gosling in one of my interviews of him why he left out operator overloading (I don't think that question and answer ended up getting published).
它还可以应用于其他一些东西,因此这样做操作符重载,就会产生一些负面影响了,以我的观点来看的话。
So there are some downsides, in my view, to doing operator overloading, but there's some real pluses.
在实战groovy的这一期中,我将介绍Groovy对操作符即时多态(也称为操作符重载)的支持。
In this installment of Practically Groovy, I introduce you to Groovy's support for operator ad-hoc polymorphism, also known as operator overloading.
这将会是个默认的或者说是,通用的来比较对象是否相同的方法,好,在每个例子中,这些事情正在做的,就是,一些与操作符重载有关的东西。
OK, in each case, what these things are doing, is they're doing, what sometimes gets referred to as operator overloading.
同一个重载的操作符让您可以在共享内存中构造类A、B和C 的对象。
The same overloaded operator allows you to construct objects of class A, B, and C in shared memory.
它包括新的启发式应用,以帮助索引器发现项目中的头文件,并增加了对隐式引用和重载操作符的索引支持。
It includes new heuristics to help indexer find header files in projects, and has added index support for implicit references and overloaded operators.
因为这会造成使得乘法操作符,对两种不同的任务造成重载。
Because this is overloading that multiplication operator with two different tasks.
顺便说一句,如果感觉迷糊,不要惊讶:使用重载操作符差不多让Groovy语言退步了。
By the way, if you're getting dizzy, don't be surprised: Using overload operators turns the Groovy language almost backwards.
Groovy支持以下算术类操作符的重载。
Groovy supports the following math-like operators for overloading.
因为它是Perl语言的一个巨大进步,在第二版中Perl还没有重载操作符的能力。
Moreover, it is completely new, because in the second edition there was no way to overload operators in Perl. This is a significant language shift, and the chapter documents it well.
可以看出,Groovy的算术类重载操作符不仅能负重,而且能做得很快!
As you can see, Groovy's math-like overload operators can not only bear quite a load, but they can do it apace!
您可能已经注意到Groovy中的+操作符已经在几个不同的领域重载了,特别是在用于集合的时候。
You may have noticed that the + operator in Groovy is already overloaded in a few different areas, especially when it comes to collections.
本书中有大量的例子,从简单(加减操作符的重载)到复杂(重载数值常量以及运行时间等)一应俱全。
There are many examples covering the range from simple (addition/subtraction overloading) to the complex (overloading numeric constants and run-time overloading).
大多数重载操作符可以定义为普通非成员函数或类的成员函数。
Most overloaded operators may be defined as ordinary nonmember functions or as class member functions.
我们将在第十四章中学习如何重载不同的操作符版本。
We'll see in Chapter 14 how to define overloaded versions of operators.
这条规则强制重载操作符不能重新定义用于内置类型对象的操作符的含义。
This rule enforces the requirement that an overloaded operator may not redefine the meaning of the operators when applied to objects of built-in type.
这条规则强制重载操作符不能重新定义用于内置类型对象的操作符的含义。
This rule enforces the requirement that an overloaded operator may not redefine the meaning of the operators when applied to objects of built-in type.
应用推荐