+ 1
How to overload an operator for struct, that is inside a class C++.
I'm very confused about where to overload an operator. In the next link you can find my code: https://code.sololearn.com/cPJgZvC0KpmT/#cpp I have a class called ElectronicEmail, where it contains a struct called Correo, that struct contains all the info that I need for my email. In another class I have an array of ElectronicEmail, where I store each ElectronicEmail object inside the array. When I try to use my shellSort method (to sort by from), I have problems with operators, I tried to overload the operator but I don't know how to do that, I'm still learning and I'm not sure if I need to overload the operators for ElectronicEmail or for Correo, also I don't know If my arguments for swapData and shellSort are correct.
2 Respuestas
0
since overloaded >= in ElectronicEmail, is actually using >= to compare two Correo
you'll also need to overload >= in Correo
0
Taste , but how I can I overload the >= for ElectronicEmail? Cause I have:
Return email >= e; where email is a struct and e is ElectronicEmail