mercredi 7 août 2019

classname classobject(); does not invoke any constructor [duplicate]

This question already has an answer here:

If I have a following situation:

#include <iostream>

using namespace std;

class A {
public:
        A() {
                cout<<"Inside A"<<endl;
        }
};

int main() {
        A a();
        return 0;
}

Why the constructor is not invoked?

Aucun commentaire:

Enregistrer un commentaire