Wednesday, October 12, 2011

Operator Overload

October 12, 2011

I was receiving the EX_BAD_ACCESS error because I had not defined the = operator for BoundingBoxes.

I discussed the possibility of using pointers to bounding boxes instead of the actual thing, but the easiest solution at present seems to be overloading the = operator.

This site proved helpful in explaining the process.

Edit/Update


Rather than overloading the operator, I set the elements individually equal to each other (setting minCorner and maxCorner manually.) This was an easy option because so few elements make up a bounding box. For larger complex objects, = or pointers would be more ideal.

No comments:

Post a Comment