Return Types of Operators
Explore how to correctly define return types when overloading operators in D. Understand guidelines for operators that modify objects, produce new objects, and logical or comparison operators, helping you write clear and efficient operator overloads.
We'll cover the following...
We'll cover the following...
When overloading an operator, it is advisable to observe the return type of the same operator on fundamental types. This will help in making sense of the code and reducing confusion.
None of the operators on fundamental types return void. This fact should be obvious for some operators. For example, the result of adding two int ...