F
F
freecam2022-02-03 14:43:01
C++ / C#
freecam, 2022-02-03 14:43:01

Why shouldn't the operator change the value of its parameters?

Hello, please explain how option 1 differs from option 2:
61fbbfaa03152640173717.png
Why should the operator not change the value of his parameters?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
freeExec, 2022-02-03
@freeExec

You write like this in code
6 = 4 + 2
. And you have a bam and 2 turned into 6, no other way is magic.

@
@insighter, 2022-02-03
_

It is not necessary to think that if the operator is unary, then its call should lead to a change in the original object.

var valid = true;
if (!valid) {
  ...
}
if (valid){
  ...
}

and what would happen if the operator ! would change the original valid variable?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question