Solution: Implement opEquals Function for a Class
Find the solution to the opEquals function challenge.
We'll cover the following
Solution
As stated in the challenge, we don’t have to include the color
member for the equality comparison. Thus, rhs
being non-null and the members being
equal would be sufficient. As in line # 17, we are making sure that rhs
object is not null and then we are comparing its first two members i.e, x
and y
, with the members of this
object.
Get hands-on with 1400+ tech skills courses.