I am getting a compilation error which I can't resolve on my own. Don't really know what to change really. Been stuck on this. Need your expertise on this please. Note:main() can't be modified. Thanks!
error: expression cannot be used as a function
is_near(polygon[index].x(), xs[index]) &&
object_polygon_test.cpp:59:28: error: expression cannot be used as a function
is_near(polygon[index].y(), ys[index]))
Hi Duthomhas, I'm really sorry for not informing that I can't actually modify the main() file.
It is restricted by my school. Thanks for ur help. Is there any other way? I am aware that it is trying to call a function named x. But I did already create one didn't I? float x() and float y(). What can I do from here on?
I think you are a little overloaded with the design. You need to reduce the number of types (classes/structs) you have. Unless your assignment specifically says otherwise, you also do not need to derive everything from a common Object.
when you do `polygon[index]' you get a PointType
`PointType' does not have a `x()' function.
by the way, you may want to review your class hierarchy, ¿a polygon is a point?
also
1 2 3 4
Polygon(PointType* points, int npoints, float depth):
msize(npoints),
mpt{new Object::PointType[npoints]},
Point(*mpt,depth) //`mpt' is uninitialized here (check out: order of construction), you are dereferencing an invalid pointer