Suppose I typedef an integer or integer array or any known type:
typedef int int2
Then I overload operator * for int2 pairs, now if I initialize variables a and b as int. Then will my * between a and b be the overloaded * ?
How do I achieve overloading an int and yet also use * for int the way they are. Should I create a new type?
Assuming you are talking about C++:
Operator overloads have to take at least one argument of user-defined type. The typedef
doesn't change anything, as it does not introduce a new type and only provides a synonym.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With