The following code:
#include <iostream>
using namespace std;
class Myclass
{
private:
Myclass ();
public:
int num;
};
int main()
{
Myclass foo();
return 0;
}
Compiles without any warnings or errors in Eclipse.
However
#include <iostream>
using namespace std;
class Myclass
{
private:
Myclass ();
public:
int num;
};
int main()
{
Myclass foo;
return 0;
}
Gives me this error: error: 'Myclass::Myclass()' is private within this context
Why does foo
give me this error while foo() doesn't?
Is foo()
being mistaken as a function or does date_type name()
have a special meaning?