Using Member Functions

Wouldn’t an easier approach to this be just making the operator >= than doing all the coding that we did?

How would using >= resolve the issue?

As the instructor states, when it’s just > then the platform of course overshoots from its original position by 1 unit.

However when it’s >= then it’ll just measure the distance reaches 0 then.

I think you misunderstood. The problem occurs if it moves past the target distance, the problem isn’t with comparing with > that’s just when the problem happens.

By using >= you would just be including the case where it wasn’t a problem.

That clears it up! Thanks!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms