mercredi 4 novembre 2015

c++ why "A a();" will not call constructor [duplicate]

This question already has an answer here:

Why A a(); won't call constructor? and why sizeof(C) is 1?

class C
{
public:
    C(){ 
        cout << "C default" << endl; 
    }
};

int main() {
    C a();
    cout << sizeof(C) << endl;
    return 0;
}

does “C a();” become a function Statement?

Aucun commentaire:

Enregistrer un commentaire