网站首页  英汉词典

请输入您要查询的英文单词:

 

单词 Operator overloading
释义

Operator overloading

中文百科

运算符重载

在计算机进程设计中,运算符重载是多态的一种。这里,运算符(比如+===)被当作多态函数,他们的行为随着其参数类型的不同而不同。运算符并不一定总是符号。

运算符重载通常只是一种语法糖。它可以简单地通过函数调用来模拟:

在一个支持运算符重载的语言里,上面的写法要比下面的写法有效而简练:

(假设运算符* 的优先级高于运算符 +)

当一种语言允许运算符在某种情况下被隐式调用的时候,运算符重载将不只提供写法上的方便。例如,Ruby中的to_s运算符就是如此,它返回一个对象的字符串表示。

英语百科

Operator overloading 运算符重载

In programming, operator overloading—less commonly known as operator ad hoc polymorphism—is a specific case of polymorphism, where different operators have different implementations depending on their arguments. Operator overloading is generally defined by the language, the programmer, or both.

随便看

 

英汉网英语在线翻译词典收录了3779314条英语词汇在线翻译词条,基本涵盖了全部常用英语词汇的中英文双语翻译及用法,是英语学习的有利工具。

 

Copyright © 2004-2024 encnc.com All Rights Reserved
更新时间:2025/6/21 15:57:16