记录详情

Compile Error

/in/foo.cc: In constructor 'Package::Package(Person, Person, double, double)':
/in/foo.cc:36:9: warning: 'Package::recip' will be initialized after [-Wreorder]
  Person recip;
         ^~~~~
/in/foo.cc:33:9: warning:   'double Package::weight' [-Wreorder]
  double weight;
         ^~~~~~
/in/foo.cc:83:1: warning:   when initialized here [-Wreorder]
 Package::Package(Person a,Person b,double w, double p) 
 ^~~~~~~
/in/foo.cc: In function 'int main()':
/in/foo.cc:149:11: error: invalid use of non-static member function 'void Package::print()'
   ptr[i]->print;
            
/in/foo.cc:27:7: note: declared here
  void print()
       ^~~~~
/in/foo.cc:150:36: error: invalid use of non-static member function 'double Package::calculateCost()'
   cout << fixed << setprecision(3) << ptr[i]->calculateCost<<endl;
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/in/foo.cc:70:8: note: declared here
 double Package::calculateCost()
        ^~~~~~~
/in/foo.cc:154:16: error: invalid use of member function 'double Package::calculateCost()' (did you forget the '()' ?)
  sum = ptr[0]->calculateCost + ptr[1]->calculateCost;
                 
/in/foo.cc:154:40: error: invalid use of member function 'double Package::calculateCost()' (did you forget the '()' ?)
  sum = ptr[0]->calculateCost + ptr[1]->calculateCost;
                                         

信息

递交者
类型
递交
题目
P1008 12.13 Package Inheritance Hierarchy
语言
C++
递交时间
2020-03-27 16:35:50
评测时间
2020-03-27 16:35:50
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes