structure construtctor

struct buf
{
int a;
buf(){
cout<<"in stuct default\n";
a = 3;
}
buf(int x) {
a = x;
cout<<"in stuct parameterizd\n";
}
};

int main()
{
1---> struct buf o3;
2---> struct buf o4();
}

While executing (1), i got the print "in stuct default", where as for {2), its not the like that.what is the difference between line (1) & (2)
Thanks in advance
Murali

The parenthesis. You are declaring a function called o4 that returns a buf and doesn't take parameters.
Thanks for your reply, i just got confused with Java style of invoking a contructor
Topic archived. No new replies allowed.