Да, вы можете напрямую использовать operator-
, унаследованный от Point
, например:
bool doIBumpIntoAnotherCircle(Circle anotherCircle){
if (anotherCircle.radius + radius >= *this - anotherCircle)
return true;
return false;
}
Или проще:
bool doIBumpIntoAnotherCircle(Circle anotherCircle){
return anotherCircle.radius + radius >= *this - anotherCircle;
}
Кроме того, эта функция должна быть помечен как const
и должен принимать параметр const&
, например:
bool doIBumpIntoAnotherCircle(Circle const &anotherCircle) const {