What is the need of hash function and why we created a hashfunction class instead if creating a hash function simply inside student class?
Unordered amp=hash function for custom class
Hey @shubhangis248
Compiler has zero idea about user defined datatype , so it is always our responsibility to teach compiler how to hash it or how to compare them etc.
And that is why we are writing code for the same and passing it as an argument to the map,
now map will use this logic for hashing and comparision.
This is syntax/rules u have to follow
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.