c++ - Problem with operator == -
I have a problem with using operator == in the following C ++ program.
#include & lt; Iostream & gt; using namespace std; Class A {Public: A (four * b) {a = b; } A (A and C) {a = c.a; } BULL operator == (A and others) {return strump (A, other .a); Private: Four * A; }; Int main () {one obj ("test"); An obj1 ("test1"); If (obj1 == A ("test1")) {cout < & Lt; "This is true" & lt; & Lt; Endl; }}
What's wrong with (if obj1 == A ("test1"))
line ?? Any help is appreciated.
child operator == (Consta and others)
Use the const context, so a floating object that can be used as the parameter for operator == in the if statement.
Comments
Post a Comment