Add a method draw() to the same class. This method will draw the circle with a certain color. Again, replace the code in your app with this method.
A plain method does exactly the same thing, every time you call it. When you think back the the class movingCircle, you might want to add a method to put the circle back in the middle of the screen:
class movingCircle {
Circle c;
Vec2 speed;
5 void reset() {
c.pos = Vec2(0);
}
}
10// somewhere in your application
movingCircle mc;
mc.reset();
15
In this example, the circle’s position will be set to zero when the reset() method is called. This method consists of three parts:
Add a method draw() to the same class. This method will draw the circle with a certain color. Again, replace the code in your app with this method.