记录详情

Compile Error

foo.cc: In member function 'int Date::DayInMonth()':
foo.cc:23:7: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   23 |       else return 28; break;
      |       ^~~~
foo.cc:23:23: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   23 |       else return 28; break;
      |                       ^~~~~
foo.cc: In function 'int main()':
foo.cc:60:20: error: 'Date::Date(int, int, int)' is private within this context
   60 |  Date date1(y, m, d);
      |                    ^
foo.cc:14:2: note: declared private here
   14 |  Date(int y, int m, int d) {
      |  ^~~~
foo.cc:62:20: error: 'Date::Date(int, int, int)' is private within this context
   62 |  Date date2(y, m, d);
      |                    ^
foo.cc:14:2: note: declared private here
   14 |  Date(int y, int m, int d) {
      |  ^~~~
foo.cc:66:14: error: 'void Date::add(int)' is private within this context
   66 |   date1.add(1);
      |              ^
foo.cc:38:7: note: declared private here
   38 |  void add(int n) {
      |       ^~~
foo.cc:67:16: error: 'bool Date::operator==(Date&)' is private within this context
   67 |   if (date1 == date2) {
      |                ^~~~~
foo.cc:53:7: note: declared private here
   53 |  bool operator==(Date& a) {
      |       ^~~~~~~~
foo.cc: In member function 'int Date::DayInMonth()':
foo.cc:37:2: warning: control reaches end of non-void function [-Wreturn-type]
   37 |  }
      |  ^
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1005 OO1-4 日期类Date
比赛
2022春 面向对象程序设计方法的上机作业
语言
C++
递交时间
2022-05-12 22:07:53
评测时间
2022-05-12 22:07:53
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes