编译出错:fatal error C1004: unexpected end of file found
#include <iostream.h>
class A {
public:
A();
virtual void foo() {
cout << "This is A." << endl;
}
};
class B : public A {
public:
B();
void foo() {
cout << "This is B." << endl;
}
};
class A::A() {}
class B::B() {}
void main()
{
A *a = new B;
a->foo();
}
以上代码在VC6.0下编译出错:fatal error C1004: unexpected end of file found
如果把A();B();构造函数改为A(){},B() {}这样的函数体,
再删除class A::A() {} class B::B() {}这两行。则编译通过。
请教各位这是什么原因?
class A {
public:
A();
virtual void foo() {
cout << "This is A." << endl;
}
};
class B : public A {
public:
B();
void foo() {
cout << "This is B." << endl;
}
};
class A::A() {}
class B::B() {}
void main()
{
A *a = new B;
a->foo();
}
以上代码在VC6.0下编译出错:fatal error C1004: unexpected end of file found
如果把A();B();构造函数改为A(){},B() {}这样的函数体,
再删除class A::A() {} class B::B() {}这两行。则编译通过。
请教各位这是什么原因?
...全文
相关推荐
C++实验常见出错信息
C++实验常见出错信息,学习C++,学好C++
VC6.0错误指令及解决方法
VC6.0 多个常见错误指令 及其解决方法
解决fatal error C1010 unexpected end of file while looking for precompiled header
解决报错fatal error C1010 unexpected end of file while looking for precompiled header directive
Visual+C+++中fatal+error+C1083的解决办法
Visual+C+++中fatal+error+C1083的解决办法
fatal error C1083: 无法打开包括文件:“stdint.h”: No such file or directory
fatal error C1083: 无法打开包括文件:“stdint.h”: No such file or directory. stdint.h是c99标准的头文件,vc不支持,所以肯定会提示“No such file or directory”的。


