Grokking Meta Coding Interview
Ask Author
Back to course home

0% completed

Vote For New Content
Dmytro Bibik
Error in 'operator<' for C++ version

Dmytro Bibik

Jun 30, 2025

Less operator for Point class has mistake, it should be const instead of return const value

bool operator<(const Point& p) const { return p.distFromOrigin() > this->distFromOrigin(); }

instead of

const bool operator<(const Point& p) { return p.distFromOrigin() > this->distFromOrigin(); }

0

0

Comments
Comments

On this page