May 2002
Beginner
320 pages
6h 18m
English
You have seen a variety of operators in C++, ranging from + and - to +=, <<, and ++. Most of these operators have well-defined meanings and apply to a fairly wide range of types, but none of them applies to user-defined types such as structs and classes. This is not especially surprising. After all, what does it mean to add two instances of aRequest together?
On the other hand, as you saw in the example that used std:string to assemble messages for runtime_error (Lesson 11, “switch Statements, static Variables, and runtime_errors”), it can be very convenient to “add” two objects of a class together. The result in that case was a string object that combined the two string objects from the right and left ...
Read now
Unlock full access