 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Matti Guest
|
Posted: Sat Oct 11, 2003 6:47 pm Post subject: Operator overloading problem |
|
|
Hello,
I have a problem comparing 2 values of type AnsiString using the ==
operator (C++ Builder 5).
I use another class called TValue, which also defines the == operator.
Now when I
try to compare 2 AnsiString Values the == operator of class TValue is
invoked.
How can I avoid that and force my program to use the operator defined
for the
AnsiString class.
Here you can see a short example of what I mean.
TValue::TValue(AnsiString Val) {
}
bool TValue::operator==(const TValue &iVal2) const {
return true;
}
test () {
AnsiString Val1, Val2;
Val1 = "Test";
Val2 = "Test";
if (Val1 == Val2) {
}
}
Thank you for your help,
Matti
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|