Login  Register

"Hash"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

"Hash"

blake watson
151 posts
On page 88 and 89, "hash" is referenced, in terms of "it should be implemented", alongside of ">" and "<" methods.

Then on 168 and 169, "hash" comes up again, in terms of being overridden.

It's not explained, however, what "hash" should do. The best clue is 

"If you override =, you should consider overriding hash. If instances of
your class are ever used as keys in a Dictionary, then you should make sure that instances that are considered to be equal have the same hash value:"

That gives a strong hint, but it could really use some elaboration.

_______________________________________________
Sbe-discussion mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion