CHAPTER 12

image

Operator Overloading

In this chapter, you’ll learn how to add support for operators such as add and subtract to your classes so that they can be applied to objects. This will make the types that you define behave more like fundamental data types and offer a more natural way to express some of the operations between objects. You’ve already seen how classes can have function members that operate on the data members of an object. Operator overloading enables you to write function members that enable the basic operators to be applied to class objects.

In this chapter you will learn:

  • What operator overloading is
  • Which operators you can ...

Get Beginning C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.