11 Friends, Overloaded Operators, and Arrays in Classes

Give us the tools, and we’ll finish the job.

WINSTON CHURCHILL, Radio Broadcast, February 9, 1941

Introduction

This chapter teaches you more techniques for defining functions and operators for classes, including overloading common operators such as +, *, and / so that they can be used with the classes you define in the same way that they are used with the predefined types such as int and double.

Prerequisites

This chapter uses material from Chapters 2 through 10.