Hour 15. Using Operator Overloading
What You’ll Learn in This Hour:
How to overload operators in member functions
How to overload the assignment operator to manage memory
How to support classes with dynamically allocated variables
Operator Overloading
The built-in types in C++ work with operators such as addition (+
) and multiplication (*
), making it easy to use these types in expressions:
int x = 17, y = 12, z;z = x * (y + 5);
The C++ compiler ...
Get Sams Teach Yourself C++ in 24 Hours, Sixth 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.