December 2003
Beginner
288 pages
7h 8m
English
Some OO languages allow you to overload an operator. C++ is an example of one such language. Operator overloading allows you to change the meaning of an operator. For example, when most people see a plus sign, they assume it represents addition. If you see the equation
X = 5 + 6;
you expect that X would contain the value 11. And in this case, you would be correct.
However, there are times when a plus sign could represent something else. For example, in the following code:
String firstName = "Joe", lastName = "Smith"; String Name = firstName + " " + lastName;
You would expect that Name would contain Joe Smith. The plus sign here has been overloaded to perform string concatenation.
String Concatenation
String concatenation ...
Read now
Unlock full access