> 其他 >
这个程序错误在哪里?
#include
using namespace std;
class Date{
public:
void setDate(int y,int m,int d);
void showDate();
private:
int year;
int month;
int year;
};
void Date::setDate(int y,int m,int d)
{
year=y;
month=m;
day=d;
}
void Date::showDate()
{cout
人气:260 ℃ 时间:2020-06-03 09:24:09
解答
私有成员只能用接口访问,在你的基础上把private改成public可以通过,或者用你的show接口,要不然不就白定义show了.在书上有详解的,别告诉我你木看.
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版