Constructor Syntax Uncertainty or Mystery Word

I am tasked with reverse engineering a large ancient codebase.
I have found the following operator overload in class_String.hpp:

 
  class_Boolean operator== (const class_String& comp_string) const;


Nowhere else in the entire code collection can I find the string "comp_string."

comp_string should be the function that handles the operation when someone puts == between two strings, right?

In that case, either I don't have all of the code, there is some code hidden somewhere I don't know to search, or the overload is never used.

Any ideas?

Thank you!


Answer: So it turns out that they use the phrase "comp_string" in the .hpp but not in the .cpp. Frustrating but I would have noticed if I was more familiar with the language.

Thanks to everyone!
Last edited on
comp_string is the name of the parameter. You don't even need a name when declaring a function. The line would have worked equally well if it was written like this:
 
class_Boolean operator== (const class_String&) const;

Often the parameter name is included anyway to give other programmers a hint of what the parameter is. To me comp_string sounds like the string to compare to. The type class_String also makes it sound like it's some kind of string (not a function).

When the operator is defined it might very well use a different name for the parameter. I guess that is why you don't find this name anywhere else.
Last edited on
You are right, thank you.
Topic archived. No new replies allowed.