Lesson 12. Operator Types and Operator Overloading

Keyword class enables you to encapsulate not only data and methods, but also operators that make it easy to operate on objects of this class. You can use these operators to perform operations such as assignment or addition on class objects similar to those on integers that you saw in Lesson 5, “Working with Expressions, Statements, and Operators.” Just like functions, operators can also be overloaded.

In this lesson, you will learn:

• Using the keyword operator

• Unary and binary operators

• Conversion operators

• C++11 move assignment operator

• Operators that cannot be redefined

What Are Operators in C++?

On a syntactical level, there is very little that differentiates an operator from a function, ...

Get Sams Teach Yourself C++ in One Hour a Day, Seventh Edition 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.