mardi 6 septembre 2016

member initializer lists in constructor with same-name variables

In this example:

class foo{
    public::
        foo(int x):x(x){
        }
        int x;
    };

My compiler is able to understand that, in x(x), the inner x is the argument and the outer x is the member variable without writing this->.

Is this behaviour a standard one?

Aucun commentaire:

Enregistrer un commentaire