所以到底什么问题啊,Tdate怎么定义
#ifndef TDATE
#define TDATE
class Tdate{
public:
void Set(int,int,int);
int IsLeapYear();
void Print();
private:
int month;
int day;
int year;
};
#endif
#include"Tdate.h"
#include<iostream>
using namespace std;
void Tdate::Set(int m,int d,int y){
month=m;day=d;year=y;
}
int Tdate::IsLeapYear(){
return (year%4==0&&year%100!=0)||(year%400==0);
}
void Tdate::Print(){
cout<<month<<"/"<<day<<"/"<<year<<endl;
void someFunc(Tdate* pS){
pS->Print();
if(pS->IsLeapYear())
cout<<"oh oh\n";
else
cout<<"right\n";
}
int main(){
Tdate s;
s.Set(2,15,1998);
someFunc(&s);
}
}