Overload operator while retaining basic functionality

Is it possible to overload an operator =without completely re-executing it?

I want to indicate a special behavior for it - if the input object has some special value → the operator must do some additional work. If not, it should work as the main assignment operator.

Sort of

operator=(input)
    if (input == specialValue)
        setParam(this->true)
    base()
+4
source share
1 answer

, if else, else , else , , , .

operator=(input)
        if (input == specialValue)
            setParam(this->true)
        esle
           setParam(input)
0

Source: https://habr.com/ru/post/1599019/


All Articles