|
20鱼币
date.h
- #include <iostream>
- class Date
- {
- public:
- void SetDate(int year,int month,int day);
- int IsLeapYear();
- void Print();
- private:
- int year,month,day;
- };
- void Date::SetDate(int year,int month,int day)
- {
- this-> year = year;
- this-> month = month;
- this-> day = day;
- }
- void Date::Print()
- {
- printf("%d,%d,%d",this->year,this->month,this->day);
- }
复制代码 date.cpp
- #include "date.h"
- #include <iostream> //为什么还要在使用一次?
- int main()
- {
- Date date;
- date.SetDate(2019,10,31);
- date.Print();
- return 0;
- }
复制代码
date.cpp 中,去掉这一行
- #include <iostream> //为什么还要在使用一次?
复制代码
完全没有问题啊,可以正常编译、运行。
|
最佳答案
查看完整内容
date.cpp 中,去掉这一行
完全没有问题啊,可以正常编译、运行。
|