Possible Duplicate:
Most vexing parse: why doesn't A a(()); work?
Difference between creating object with () or without
There is such code:
class MojaKlasa{
public:
MojaKlasa(){}
MojaKlasa(int i){}
void fun(){}
};
int main()
{
MojaKlasa a;
a.fun();
MojaKlasa b(1);
b.fun();
MojaKlasa c(); // initialize with default constructor
//c.fun(); error: request for member ‘fun’ in ‘c’, which is of non-class type ‘MojaKlasa()’
return 0;
}
- Why is there error for object c?
- What is the way to make it work?
- What does really mean MojaKlasa c() - is it function declaraton?