Why does the code below compile?
class Test
{
public:
Test(int i) {}
private:
Test();
};
int main()
{
// OK - uses Test(int i)
Test test(5);
// Error - Test() is private
// Test test2;
// Why does this compile? Test() is private!
Test test3();
}
I would think that the last instanciation would fail to compile since the no-param constructor is private?