一道面试题


找出下面代码的错误:

#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 josh.yang 阅读(275) 评论(0) 编辑 收藏
©2005-2008 Suprasoft Inc., All right reserved.