My assignment is to derive a new class called Smiley from an existing class called Circle. I am using FLTK & C++.
Circle is:
struct Circle : Shape {
Circle(Point p, int rr) // center and radius
:r(rr) { add(Point(p.x-r,p.y-r)); }
void draw_lines() const;
Point center() const;
void set_radius(int rr) { set_point(0,Point(center().x-rr,center().y-rr)); r=rr; }
int radius() const { return r; }
private:
int r;
};
(The add
method is a free method, not part of Circle)
And what I have created for Smiley so far is
class Smiley : public Circle {
public:
Smiley (Point p, int r) : Circle (a, r){
return;
}
};
I'm trying to figure out how to add circular eyes and a semi-circle mouth. I have an extremely vague idea of what the eyes should look like
Circle left_eye(Point(p.x - (r/3), p.y - (r/3)), (r/8)); //left eye
Circle right_eye(Point(p.x + (r/3), p.y - (r/3)), (r/8)); //right eye
But I don't even know how to incorporate it into my Smiley class, or if that's even the proper format. Help would be much appreciated, thanks.