I am inexperienced of using c++ and stuck at the point where compiler generates invalid operands to binary expression
class Animal{
public:
int weight;
};
int main(){
Animal x, y;
x.weight = 33;
y.weight = 3;
if(x != y) {
// do something
}
}
I want to use x and compare with y, without modifying code i.e. (x.weight != y.weight)in the main code. How should I approach this problem from external class or definition ?