Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Intermediate C#!
You have completed Intermediate C#!
Preview
By overriding Object.Equals we get to decide what it means for two objects to be equal to each other.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
system.object we'll find
a method named Equals.
0:00
This is the method that is called
to determine if two objects
0:03
are practically equal.
0:06
By default, it just calls
the ReferenceEquals method to see if two
0:08
objects refer to the same object but
we can override this behavior.
0:12
Let's do that in the point class and map
location will inherit this new behavior.
0:16
So we can overwrite equals to return true
0:22
if the coordinates of
the two points are equal.
0:24
So we'll say public override.
0:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up