"roopa" <ro***@googley.com> wrote in message
news:ba**************************@posting.google.c om...
Re: Difference Between List x; and List x(); , if 'List' is a Class?
For this issue it makes no difference what the type of 'List' is.
I have declared a class with name List;
and in main() function, i have declared the List object as follows
class List
{
public:
List()
{
cout<<"In List Constuctor";
}
};
int main(int argc, char* argv[])
{
List x1;
List x2();
}
Could anybody let me know, What is the difference between "List x1;"
and "List x2();" ?
List x1;
/* creates object of type 'List', named 'x1'. */
List x2();
/* Declares (but doesn't define) a function nameed 'x2',
that takes no arguments and returns a value of type 'List'. */
You should get a 'missing function' error at link time.
-Mike