C++ Overloading Math Operator in Class [5]
Vložit
- čas přidán 13. 09. 2024
- Learn how to overload arithmetic operators for your classes. Learn through writing a sample class that includes operator+, operator*, etc in this C++ tutorial for beginners written with Visual Studio 2022 C++ .
// Join the new Programming for Everyone Community Forum:
professorhank....
// Learn More //
More About Classes playlist: • CH14: More About Classes
// Consider supporting this channel in multiple ways
paypal.me/hank...
Bitcoin: 177wfkQwzXiC8o2whQMVpSyuWUs95krKYB
Sorry maybe I missed something but 1.85 * 1.86 = 3.44?
You’ve got to be pretty crazy to overload your operators. C++ is already hard enough with the default ones.
I hear ya, and Java would agree with you!
Barely an inconvenience 😂
how is simplify working if it isnt being called?
Functions can call functions. If the function call is inside of operator+, then when x + y executes, operator+ executes, and calls function simplify.