+ 2
How does this code work?
Why there is no output? #include <iostream> using namespace std; class A { public: A() { cout << "Class A!"; } A(int a = 0) { cout << "A"; } }; int main() { A a(); } https://code.sololearn.com/ctnrvYPt2n6D/#cpp
1 Answer
+ 1
I think A a() does not even call the constructor at all and should've failed the compilation step. So a() in this case is removed from the final executable.