Add the pure virtual method virtual bool contains (double x, double y) = 0; to the GObject class presented in Figure 19-5 and then implement that method for each of the subclasses. For the GRect and...


Add the pure virtual method


virtual bool contains (double x, double y) = 0;


to the GObject class presented in Figure 19-5 and then implement that method for each of the subclasses. For the GRect and GOval subclasses, the contains method should return true if the specified point is inside the object, and false if it is outside. For the GLine class, contains should return true if the point is within half a pixel distance of the line. If you are unsure of how to determine whether a point is inside a GOval or how to calculate the distance from a point to a line, you should do what professional programmers do in such circumstances: look the answer up on the web.

Nov 18, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here