I am new to C++, moving from Java and wondering about this:
pos = result.find(remove[i]);
if (pos == string::npos)
is it calling the string “superclass”? I am confused if it is calling the class itself accesing the constant “npos” how does it know which instance of the class it is if I have several string variables declared in my function?
nposis not bound to an instance, but to the class itself. It’s astaticmember. There arestaticmembers in Java as well.21.4 Class template basic_string [basic.string]
[…]
std::stringis a specialization ofbasic_string.