CodeBlocks を使用していますが、コンパイルできない次のコードがあります。
(これはいくつかの C++ の落とし穴に関するものなので、私が聞きたいのはコンパイルできない理由だけです)
コードは次のとおりです。
#include <iostream>
using namespace std;
class Shape
{
public:
Shape();
virtual void reset();
private:
int color;
};
class Point : public Shape
{
private:
double a,b;
};
void Shape::reset()
{
cout<<"Shape reset\n";
}
void Point::reset()
{
Shape::reset();
cout<<"Point reset";
}
Shape::Shape()
{
reset();
}
int main()
{
Shape s;
Point o;
}
次のエラーが表示されます。
no `void Point::reset()' member function declared in class `Point'