I'm doing something fairly simple - checking the intersection of two circles.
In main():
Circle c1 = Circle(0,0,5) //x, y, radius
Circle c2 = Circle(4,0,2)
if (c1.intersects(c2)) {
cout << "c1 intersects c2";
}
In the circle implementation file:
Circle::Circle() {
cX = 0;
cY = 0;
cR = 10;
}
void Circle::setX(int x) {
cX = x;
}
void Circle::setY(int y) {
cY = y;
}
int Circle::getX() const {
return cX;
}
int Circle::getY() const {
return cY;
}
Circle::intersects(Circle c) {
//I need to have access to both c1's X attribute, AND c2's X attribute in order to calculate whether or not they intersect.
//As a simpler example, let's say that I wanted to compare c1.getX() and c2.getX() and see which one was larger. How would I go about this?
}
I obviously didn't include the whole implementation file, but this should hopefully be enough to explain my question.
I would appreciate any help with this! If I didn't give enough information, feel free to ask.
Thanks!