注册 登录
编程论坛 C++教室

意外结尾是什么意思啊!!!

a632034079 发布于 2009-10-25 18:47, 519 次点击
编译时说什么意外结尾。。。。帮忙看下..........错误报告在下面。。



#include <iostream.h>
class Animal
{
public:
    void eat()
    {
        cout<<"animal eat"<<endl;
    }
    void sleep()
    {
        cout<<"animal sleep"<<endl;
    }
    virtual void breathe()
    {
        cout<<"animal breathe"<<endl;
    }
    Animal()
    {
    }
    Animal(int heigeht,int weight)
    {
        cout<<"animal constuct"<<endl;
    }
};
class Fish:public Animal
{
public:
    Fish():Animal(300,400)
    {
        cout<<"fish contruct"<<endl;
    }
    void breathe()
    {
        cout<<"fish bublle"<<endl;
};
/*void fn(Animal* pAn)
{
    pAn->breathe();
}*/
void main()
{
    Animal an;
    an.eat();
//    Animal* pAn;
    Fish fh;
//    pAn=&fh;
//    fn(pAn);
    fh.breathe();   
}

错误报告:
--------------------Configuration: di2bian - Win32 Debug--------------------
Compiling...
woyumen a.cpp
E:\C++\MSDev98\MyProjects\di2bian\woyumen a.cpp(50) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.

di2bian.exe - 1 error(s), 0 warning(s)
5 回复
#2
a6320340792009-10-25 18:53
那位大虾在啊
帮忙看看啊
#3
a6320340792009-10-25 18:55
找到了没是了
#4
qlc002009-10-26 16:59
第二个类少一个括号!
#5
flyingcloude2009-10-26 19:03
class Fish:public Animal
{
public:
    Fish():Animal(300,400)
    {
        cout<<"fish contruct"<<endl;
    }
    void breathe()
    {
        cout<<"fish bublle"<<endl;
    }
};
#6
chiZ2009-10-27 02:50
1. the library is <iostream> // no ".h" after iostream
2. you forget "using namespace std"
1