| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 440 人关注过本帖
标题:unexpected end of file found
只看楼主 加入收藏
一切皆安
Rank: 2
等 级:论坛游民
帖 子:70
专家分:46
注 册:2011-4-2
结帖率:91.67%
收藏
已结贴  问题点数:5 回复次数:5 
unexpected end of file found
#include<iostream>
using namespace std;
class father
{
private:
        int fatherheight,fatherweight;
public:
    void setfatherheight(int fatherheight){fatherheight=fatherheight;
    void setfatherweight(int fatherweight){fatherweight=fatherweight;
    void Showfatherheight()
    {
    cout<<"height="<<fatherheight<<"\t"<<"weight="<<fatherweight<<endl;
    }
};
class son: public
{
private:
    int sonwidth,sonlength;
public :
    void setwidth(int sonwidth){sonwidth=sonwidth;}
    void setlength(int sonlength){sonlength=sonlength;}
    void Showsondate(){cout<<"length="<<sonlength<<"\t"<<"width="<<sonwidth<<endl;
};
int main()
{
son a;                       
a.setfatherheight(160);
a.setfatherweight(60);
a.setsonwidth(60);
a.setsonlength(80);
a.Showfatherheightweight();
a.Showdatesondate();
return 0;
}
好像没错误吧,不知道错在哪,郁闷
搜索更多相关主题的帖子: private 
2011-06-04 12:02
caihongf
Rank: 1
等 级:新手上路
帖 子:3
专家分:7
注 册:2011-5-7
收藏
得分:0 
不明白,应该好好学习请教一下

[url=http://www./]早泄咋办[/url]
2011-06-04 12:27
ToBeStronger
Rank: 4
等 级:业余侠客
帖 子:61
专家分:239
注 册:2011-4-8
收藏
得分:5 
回复 楼主 一切皆安
class son: public
楼主这一行怎么回事,后面至少应该跟上 public father吧
2011-06-04 13:54
ToBeStronger
Rank: 4
等 级:业余侠客
帖 子:61
专家分:239
注 册:2011-4-8
收藏
得分:0 
回复 楼主 一切皆安
a.setsonwidth(60);
a.setsonlength(80);
a.Showfatherheightweight();
a.Showdatesondate();
return 0;
还有这几行,楼主明显调用的方法名写错了,应该是a.setwidth(60),a.setlength(80);楼主你好好看看你是son类里面方法是怎么写的
2011-06-04 14:01
ToBeStronger
Rank: 4
等 级:业余侠客
帖 子:61
专家分:239
注 册:2011-4-8
收藏
得分:0 
回复 楼主 一切皆安
#include<iostream>
using namespace std;
class father
{
private:
    int fatherheight,fatherweight;
public:
    void setfatherheight(int height){fatherheight=height;}
    void setfatherweight(int weight){fatherweight=weight;}
    void Showfatherheightweight()
    {
        cout<<"height="<<fatherheight<<"\t"<<"weight="<<fatherweight<<endl;
    }
};
class son: public father
{
private:
    int sonwidth,sonlength;
public :
    void setsonwidth(int width){sonwidth=width;}
    void setsonlength(int length){sonlength=length;}
    void Showsondate(){cout<<"length="<<sonlength<<"\t"<<"width="<<sonwidth<<endl;};
};
int main()
{
    son a;                       
    a.setfatherheight(160);
    a.setfatherweight(60);
    a.setsonwidth(60);
    a.setsonlength(80);
    a.Showfatherheightweight();
    a.Showsondate();
    return 0;
}
我帮你修改过的,已经运行成功,你对照对照吧

2011-06-04 14:18
一切皆安
Rank: 2
等 级:论坛游民
帖 子:70
专家分:46
注 册:2011-4-2
收藏
得分:0 
谢谢了
2011-06-04 15:47
快速回复:unexpected end of file found
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011842 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved