overloading

Computer Science An Overview _J. Glenn Brookshear _11th Edition_C

Many programming languages allow the use of one symbol to represent more than one operation. In these cases the meaning of the symbol is determined by the data type of the operands. For example, the symbol  traditionally indicates addition when its operands are numeric, but in some languages, such as Java, the symbol indicates concatenation when its operands are character strings. That is, the result of the expression

“abra” + “cadabra”

is abracadabra. Such multiple use of an operation symbol is called overloading. While many languages provide built-in overloading of a few common operators,others such as Ada, C++, and C# may allow programmers to define additional overloaded meanings or even add additional operators.

posted @ 2016-11-09 12:16  papering  阅读(241)  评论(0编辑  收藏  举报