Friday, 13 September 2013

Equality operator issue (C++)

Equality operator issue (C++)

I'm getting the error
no match for 'operator==' in
'MyNestedClassPointer->MyClass::MyNestedClass::NestedVar == s'
Where s is a reference to a string, and NestedVar is a pointer to a
string. The offending line of code is an if statement comparing the two to
see if they're identical.
if(thePointer->theVar == s)
I have no overloaded operators, but I don't think I should have a need for
them, seeing as these are just string pointers we're dealing with. Now
correct me if I'm wrong, since I'm more than a little rusty, but can't I
do this?
I also apologize if my question is phrased 'incorrectly,' it's my first
post here.

No comments:

Post a Comment