记录详情

Compile Error

/in/foo.cc: In constructor 'CheckingAccount::CheckingAccount(double, double)':
/in/foo.cc:45:60: error: 'double Account::balance' is private within this context
  CheckingAccount(double v = 0.0, double f = 0.0) : ff(f) { balance = v; }
                                                            ^~~~~~~
/in/foo.cc:37:9: note: declared private here
  double balance;
         ^~~~~~~
/in/foo.cc: In member function 'bool CheckingAccount::credit(double)':
/in/foo.cc:47:7: error: 'double Account::balance' is private within this context
   if (balance + v - ff >= 0) return (balance += v - ff, true);
       ^~~~~~~
/in/foo.cc:37:9: note: declared private here
  double balance;
         ^~~~~~~
/in/foo.cc:47:38: error: 'double Account::balance' is private within this context
   if (balance + v - ff >= 0) return (balance += v - ff, true);
                                      ^~~~~~~
/in/foo.cc:37:9: note: declared private here
  double balance;
         ^~~~~~~
/in/foo.cc: In member function 'bool CheckingAccount::debit(double)':
/in/foo.cc:51:7: error: 'double Account::balance' is private within this context
   if (balance >= v + ff) return balance -= v + ff, true;
       ^~~~~~~
/in/foo.cc:37:9: note: declared private here
  double balance;
         ^~~~~~~
/in/foo.cc:51:33: error: 'double Account::balance' is private within this context
   if (balance >= v + ff) return balance -= v + ff, true;
                                 ^~~~~~~
/in/foo.cc:37:9: note: declared private here
  double balance;
         ^~~~~~~
/in/foo.cc: In constructor 'SavingAccount::SavingAccount(double, double)':
/in/foo.cc:63:3: error: 'double Account::balance' is private within this context
   balance = v;
   ^~~~~~~
/in/foo.cc:37:9: note: declared private here
  double balance;
         ^~~~~~~
/in/foo.cc: In member function 'double SavingAccount::calculateInterest()':
/in/foo.cc:69:10: error: 'double Account::balance' is private within this context
   return balance * ra / 100;
          ^~~~~~~
/in/foo.cc:37:9: note: declared private here
  double balance;
         ^~~~~~~

信息

递交者
类型
递交
题目
P1006 11.10 Account_Inheritance
语言
C++
递交时间
2020-03-19 23:47:15
评测时间
2020-03-19 23:47:15
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes