| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 515 人关注过本帖
标题:程序编译错误 求指教
取消只看楼主 加入收藏
糊涂无罪
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:37
专家分:161
注 册:2012-5-28
结帖率:77.78%
收藏
已结贴  问题点数:20 回复次数:3 
程序编译错误 求指教
#include <iostream>
using namespace std;
class vehicle{
public:
    void run (){};
    void stop (){};
    vehicle(double ms,double w){
        maxspeed=ms;
        weight=w;
        cout<<"constring vehicle in called"<<endl;}
private:
    double maxspeed;
    double weight;
};
class bicycle:public vehicle{
public:
    bicycle(double h,double ms,double w):vehicle(ms,w){
        hight=h;
        cout<<"constring bicycle is called"<<endl;}
private:
    double hight;
};
class motorcar:public vehicle{
public:
    motorcar(double n,double ms, double w):vehicle(ms,w){
        seatnum=n;
        cout<<"constring motorcar is called"<<endl;}
private:
    double seatnum;
};
class motorcycle:public bicycle,public motorcar{
public:
    motorbicycle(double n,double h,double ms,double w):bicycle(double h,double ms,double w),
        motorcar(double n,double ms,double w)
    {cout<<"constring of motorbicycle is called"<<endl;}
};
int main(){
    motorbicycle m1(1.0,2.0,3.0,4.0);
    return 0;
}
搜索更多相关主题的帖子: double void private include public 
2012-05-28 17:53
糊涂无罪
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:37
专家分:161
注 册:2012-5-28
收藏
得分:0 
受教了,谢谢各位!问题解决了,二楼辛苦了。有劳各位了,以后多指教。
2012-05-30 09:57
糊涂无罪
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:37
专家分:161
注 册:2012-5-28
收藏
得分:0 
麻烦再问一下,使用虚基类有什么好处呢?求指教。谢谢!
2012-05-30 09:59
糊涂无罪
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:37
专家分:161
注 册:2012-5-28
收藏
得分:0 
回复 8楼 lknight
问题解决,谢谢解惑!
2012-05-31 18:48
快速回复:程序编译错误 求指教
数据加载中...
 
   



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

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