bool operator==(const Name& first, const Name& second) { //printf("first=%s, second=%s", first.getName().c_str(), second.getName().c_str()); if (first.getName() == second.getName()) { //printf(" both are the same \r\n"); return true; } else { //printf(" they are different \r\n"); return false; } }
int main(){ Name na; na.setName("Dhruv"); cout<<na.getName()<<endl; return 0; }
bool operator<(const Name& first, const Name& second) { return (first.getName() < second.getName()); }
// Define a "less than" operator for comparison: used for hashing bool operator<(Name a, Name b) { return strcmp(a.getName(), b.getName())< 0; }