O'Reilly logo

The C++ Programming Language, Fourth Edition by Bjarne Stroustrup

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

18. Operator Overloading

When I use a word it means just what I choose it to mean – neither more nor less.

– Humpty Dumpty

Introduction

Operator Functions

Binary and Unary Operators; Predefined Meanings for Operators; Operators and User-Defined Types; Passing Objects; Operators in Namespaces

A Complex Number Type

Member and Nonmember Operators; Mixed-Mode Arithmetic; Conversions; Literals; Accessor Functions; Helper Functions

Type Conversion

Conversion Operators; explicit Conversion Operators; Ambiguities

Advice

18.1. Introduction

Every technical field – and most nontechnical fields – has developed conventional shorthand notation to make convenient the presentation and discussion involving frequently used concepts. For example, because ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required