0

コンパイルするコードを取得しようとしています (このコード) が、25 行目をコメントアウトする
virtual void info()=0;
と、コンパイルされません:

shape.cpp: In function ‘int main()’:
shape.cpp:345:11: error: ‘class shape’ has no member named ‘info’
  svec[0]->info();

しかし、25行目を維持すると、純粋仮想関数に関する非常に長いエラーが発生します...

shape.cpp:77:15: error: cannot declare parameter ‘squ’ to be of abstract type ‘square’
   cube(square squ):
               ^
shape.cpp:30:7: note:   because the following virtual functions are pure within ‘square’:
 class square : public shape {
       ^
shape.cpp:25:16: note:  virtual void shape::info()
   virtual void info()=0;
                ^
shape.cpp:167:20: error: cannot declare parameter ‘rec’ to be of abstract type ‘rectangle’
   cuboid(rectangle rec, double d):
                    ^
shape.cpp:110:7: note:   because the following virtual functions are pure within ‘rectangle’:
 class rectangle : public shape {
       ^
shape.cpp:25:16: note:  virtual void shape::info()
   virtual void info()=0;

等々...

私が間違っていることについて誰かが私に考えを与えることができますか? ありがとう。

4

1 に答える 1