Order of evalution in method chaining

This post is related to my earlier one. Expanding on the subject of the order of evalutions, let’s start with an example:


class A
{
public :
    A() : _myValue(0) {};

    A& IncrVarTen()
    {
        _myValue += 10;
        cout << "value is:" << _myValue << endl;
        return *this;
    }

    A& IncrVarTwenty()
    {
        _myValue += 20;
        cout << "value is:" << _myValue << endl;
        return *this;
    }

    int _myValue;
};


int main()
{
    A a;
    a.IncrVarTen().IncrVarTwenty();
    cout << "Final value is:" << a._myValue << endl; 
    return 0;
}

Continue readingOrder of evalution in method chaining