[DGD] operator+ as absolute value function?

nikoroleva natasha.i.koroleva at gmail.com
Sun May 19 19:55:04 CEST 2019


I started to play with the idea of a Number object and came across an
"I wonder if I can do that?" scenario. After writing operator- with
varargs, I wondered if the same was possible with operator+

Number m, n;

m = new Number(-0.8);
n = +m;

n ==> -0.8, not 0.8

I wasn't expecting 0.8 as it would be inconsistent with int and float.
My question is if that's the whole reason, or if there is something
more/else to consider?

A second question. It seems that something like +m doesn't even go
into operator+. Is that correct?

Regards


More information about the DGD mailing list