#include <iostream>
using namespace std;
int month;//全局变量
int day;
int year;
void Set(int m,int d,int y)// -----------------------------------------------------a
{
::month=m; //-----------------------------------------------------①
::day=d;
::year=y;
}
class CDate
{
public:
void Set(int m,int d,int y)// -----------------------------------------------------b
{
::Set(m,d,y); //-----------------------------------------------------②
}
void Print()
{
cout<<month<<"/"<<day<<"/"<<year<<endl;
}
private:
int month; //成员变量
int day;
int year;
};
void main()
{
CDate a;
a.Set(10,15,2007) ;
a.Print();
}
艾尔森
相关分类