The problem is the following: in the class shape
you declared draw as taking no parameter:
virtual void Draw(void)=0;
whereas the subclass circle
and square
has draw
expecting a double:
void Draw(double radius)
In circle
, I think radius
(together with probably something like center) should be passed to the constructor and draw should accept nothing. For example:
class circle:public shape{
private:
double radii;
public:
circle(double radius) radii(radius) {};
void Draw(){
cout << "The radius of the circle is " << radii<<endl;
}
};
Then you use it as
circle *p = new circle(radius);
p->Draw();
Or if you don't need dynamic allocation:
circle c(radius);
c.Draw()
Of course class square
has the same problem.