Why I can’t use append() to add a variable to a string?

  append, c++, push-back

I have a piece of code:

char temp = word[0];
word.erase(0, 1);
word.append(temp);     //word.push_back(temp); is fine

I got an error:
error: no matching member function for call to ‘append’

My question is why I can’t use append() here? Thanks in advance!

Source: Windows Questions C++

LEAVE A COMMENT