I have a question : what constructor is used when you create an instance of a class with ClassName instance()
in C++ ?
Example:
#include <iostream>
using namespace std;
class Test
{
private:
Test()
{
cout << "AAA" << endl;
}
public:
Test(string str)
{
cout << "String = " << str << endl;
}
};
int main()
{
Test instance_1(); // instance_1 is created... using which constructor ?
Test instance_2("hello !"); // Ok
return 0;
}
Thanks !