Operator Overloading

  • Ivor Horton
  • Peter Van Weert
Chapter

Abstract

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 member functions that operate on the member variables of an object. Operator overloading enables you to write member functions that enable the basic operators to be applied to class objects.

Copyright information

© Ivor Horton and Peter Van Weert 2018

Authors and Affiliations

  • Ivor Horton
    • 1
  • Peter Van Weert
    • 2
  1. 1.Stratford-upon-AvonUK
  2. 2.Kessel-LoBelgium

Personalised recommendations