一道面试题


找出下面代码的错误:

#include <stdio.h>

class Test
{
public:
    Test( 
int ) {}
    Test(
double) {}
    Test() {}
    
void fun() {}
};
int main()
{
    Test a(
1);
    a.fun();
    Test b();
//here define a function, no the object declaration!!
    b.fun();

    
return 0;
}

具体参见《C++ primer》P569
posted @ 2007-10-19 23:14  中土  阅读(630)  评论(0)    收藏  举报
©2005-2008 Suprasoft Inc., All right reserved.