标题:求助关于多个类的 c++ 程序
取消只看楼主
墨痕YHZ
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-10-21
 问题点数:0 回复次数:0 
求助关于多个类的 c++ 程序
#include<iostream>
using namespace std;
class Anmial
{
public:
virtual void color()=0;
virtual void weight()=0;
~Anmial()
};
class dog:public Anmial
{
public:
void color();
void weight();
~dog()
};
class bird:public Anmial
{
public:
void color();
void weight();
~bird()
};
class cat:public Anmial
{
public:
void color();
void weight();
~cat()
};
#include<dog.h>
void dog::color()
{
cout<<"狗的毛色:黑色"<<endl;
}
void dog::weight()
{
cin>>weight;
cout<<"狗的体重:"<<weight<<endl;
}


#include<bird.h>
void bird::color()
{
cout<<"鸟的毛色:黄色"<<endl;
}
void bird::weight()
{
cin>>weight;
cout<<"鸟的体重:"<<weight<<endl;
}

#include<cat.h>
void cat::color
{
cout<<"猫的毛色"<<endl;
}

void cat::weight()
{
cin>>weight;
cout<<"猫的体重:"<<weight<<endl;
}

void main()

{

}




希望把这个程序改成含有多重继承,运算符重载,静态变量,虚函数,构造、析构函数的程序
搜索更多相关主题的帖子: include public color 
2014-10-22 21:32



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-437560-1-1.html




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

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