Operator Overloading

Steven Zeil

Old Dominion University, Dept. of Computer Science

Table of Contents

1. Operators
1.1. Operators are Functions
1.2. Declaring Operators
1.3. Keep it Natural
2. I/O Operators
2.1. Providing the Output Operator
2.2. Using the Output Op
2.3. Fine Points
3. Comparison Operators
3.1. Comparison Operators for Time
3.2. Equality Operators for Compound Data
3.3. Less-than Operators for Compound Data
3.4. Adding Both == and <
4. The Assignment Operator
4.1. Compiler-Generated Assignment Ops
4.2. Example: BidCollection: Guess what happens
4.3. Avoiding this Problem
4.4. Implementing Assignment
5. The Rule of the Big 3
5.1.
5.2.
5.3.
5.4. The Rule of the Big 3
5.5. Providing the Big 3