Accessing cstyle variable from object to compare with another.

I want to compare a cstyle string (tool) with another cstyle string (tool2).
The main problem is that tool2 is in another class as tool, and tool is in a different class itself, therefore I cannot compare an object with a cstyle string.
Any suggestions to get around this problem?

Example:
1
2
3
4
5
6
7
8
//This function is placed in the same class as tool.
bool CompareTool (const Box & tool2 )
   {  
      if (strcmp(tool, tool2))//Cannot compare cstyle string with object.
         return true;
      else 
         return false;
   }

If the other string is in another class, you aren't even supposed to know it's there. You're attacking your problem from the wrong angle.
Lets say the class CreateTool has tool in it.
All strings are stored as different objects. The objects are created within the main() function, and then stored into an array of objects that is in another class (Box).
My problem is how to use tool2 from Box and implement it in CreateTool to compare with tool.
:/
I don't understand the hierarchy, maybe a quick sketch up of it would help?

Anyway, what if you made a conversion operator for Box that converts it to a cstyle string?

e.g.
1
2
3
4
class Box
{
    public:
        operator const char * ()const; //Return Box as cstyle string... 
Topic archived. No new replies allowed.