vendredi 5 mars 2021

Function argument initialization in same line in C++ [duplicate]

I am familiar with this approach, I just need to know what this approach is called.

class MyClass {
    int A, B;
public:
    MyClass(int a, int b) : a(A), b(B) {}
};

I am keen to know the name of this approach of initialization of class variables directly in the function argument list line.

If I am missing something in this understanding, please highlight that as well.

Aucun commentaire:

Enregistrer un commentaire