+ 1
Could you explain why the output of the code is nothing. My understanding is that "A a()" calls the "A(int a)..." function but f
#include <iostream> using namespace std; class A{ public: A(){cout<<"It's A class";} A(int a){cout<<"A";} }; int main() { A a(); return 0; }
1 Resposta
+ 1
A a(); actually creates a function called a with no body.
A a; is all you would need to call the default parameterless constructor.
https://stackoverflow.com/questions/5300124/calling-the-default-constructor