一道面试题
找出下面代码的错误:
#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;
}
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