郁闷了,小弟菜鸟一个,弄了一中午到最后一调还是两个错误.大家看下帮忙纠正下:
#include <iostream.h>
using namespace std;
class Tdate{
public:
void Set(int,int,int); //成员函数声明
void Print();
friend class Pdate;
private:
int month;
int day;
int year;
};
class Pdate:public Tdate{
public:
void set1(int,int,int,int,int);
void print1();
void print2();
private:
int month1;
int day1;
int year1;
};
void Tdate::Set(int x,int y,int z)
{
day=x; month=y; year=z;
}
void Tdate::Print()
{
cout<<"输出当前日期"<<endl;
cout <<day <<"/" <<month <<"/" <<year <<endl;
}
void Pdate::set1(int m,int n,int c,int d,int u)
{
int q;
cin>>q;
m=(25+q)/30;
n=(25+q)%30;
c=(6+m)/12;
d=(6+m)%12;
u=2007+c;
u=year1;
d=month1;
n=day1;
}
void Pdate::print1()
{
cout<<"请输入所要增加的天数"<<endl;
}
void Pdate::print2()
{
cout<<"增加天数后的日期"<<endl;
cout <<day1 <<"/" <<month1 <<"/" <<year1<<endl;
}
int main()
{
Tdate a;
a.Set(25,6,2007);
a.Print();
Pdate f;
f.print1();
f.set1();
f.print2();
}
到目前有两个错误,一个是no matching function for
call to `Pdate::set1()'
另一个是candidates are: void
Pdate::set1(int, int, int, int, int)
小弟我愚昧,实在看不出来,大哥们帮忙
我的程序编的也很烂 有什么需要修改的地方 告诉一下