c++编程实例设计一个日期类,包含年.月.日三个数据成员,两个成员函数SetDate,ShowDate分别用来设置日期和显
展开全部
class Data
{
public:
Data();
~Data();
public:
void SetData(int nYear, int nMonth, int nDay)
{
m_nYear = nYear;
m_nMonth = nYear;
m_nDay = nDay;
}
void ShowData()
{
cout << m_nYear << "-" << m_nMonth << "-" << m_nDay << endl;
}
private:
int m_nYear;
int m_nMonth;
int m_nDay;
};
{
public:
Data();
~Data();
public:
void SetData(int nYear, int nMonth, int nDay)
{
m_nYear = nYear;
m_nMonth = nYear;
m_nDay = nDay;
}
void ShowData()
{
cout << m_nYear << "-" << m_nMonth << "-" << m_nDay << endl;
}
private:
int m_nYear;
int m_nMonth;
int m_nDay;
};
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询