My code is showing some error ‘const char [4]’ to non-scalar type 'Student
and why we are using bool operator==( )
and i dont understand use of size_t what is the need of size_t .
Hash function for custom class
@Satyamcoder dont use = sign with constructors.
See here, its running fine now https://ide.codingblocks.com/s/290885
size_t
It’s a type which is used to represent the size of objects in bytes and is therefore used as the return type by the sizeof operator. Its unsigned in nature.
we are overloading the equality operator == by this. You will learn about operator overloading in the OOPS section.
i dont understand when we updating the value then why bool== compare function runing
can we use int instead of size_t then why we are using size_t
size_t is conventionally used for such type of values, you can use int also but it’s like wasting space, you don’t need space for negative numbers. You need space only for positive numbers because size can never be negative. So its better to use an unsigned type