C++ Operator Overloading: Mathematical Notation for Custom Types
This tutorial walks through C++ operator overloading by building a 2D physics vector from scratch. It covers binary arithmetic operators, scalar multiplication with friend non-members, compound assignment, equality and comparison, stream insertion, subscript, and unary minus — explaining the rules that make each operator correct and the physics simulation that makes the need for them obvious.
Комментарии