请大家帮忙看看这个关于继承实现的C++问题我写的代码有什么错呢?

[复制链接]
查看11 | 回复4 | 2012-11-3 15:09:03 | 显示全部楼层 |阅读模式
你程序错误好多!如果用VC的话,要加.h头,另外VC编译器区分大小写,C++不像其他语言,C++没有string类型,以下是你程序改正能使编译通过的代码#include//using namespace std;class Date{
int year,month,day;public:
Date(int x,int y,int z)
{
year=x;
month=y;
day=z;
}
Date() {}
void datedisplay() const
{
...
回复

使用道具 举报

千问 | 2012-11-3 15:09:03 | 显示全部楼层
楼上用的时VC6.0。楼主千万别学他。双击错误提示,看下IDE帮你跳到哪一行,就说明哪一行出了问题。Date() {;} 应该是这个错了。改成Date(){} 还有要包含string的头文件,在开头加上一行include ...
回复

使用道具 举报

千问 | 2012-11-3 15:09:03 | 显示全部楼层
#include#includeusing namespace std;class Date{private:
int year,month,day;public:
Date(int x=0,int y=0,int z=0)
{
year=x;...
回复

使用道具 举报

千问 | 2012-11-3 15:09:03 | 显示全部楼层
没包含头文件#include ...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行