Regarding, hash function for custom class

sir, 1.)why we have made class instead of functions for hashfunction. 2.) what is the pusrpose of taking size_t? 3.) compiler was showing error before using const in operator overloading, why?

it is basically used when overloading the () operator

will handle both signed and unsigned int

There are a wide range of cases where you would pass by value except that the argument type is expensive to copy (either because it is more than a few words in size, or because copying it requires nontrivial logic). If that is the case, and the function doesn’t need to modify the argument, and the function doesn’t need to make a copy of the argument, then the best practice is to pass by const lvalue reference. A const T& argument is very convenient since it can accept both lvalues and rvalues without making a copy.
https://www.quora.com/Why-do-we-use-const-and-when-we-use-operator-overloading-in-C++

read this for better understanding

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.