samedi 5 décembre 2015

Why does the compiler think my string is a char variable?

So I am trying to get my std::string and char mastery on... Except, I can't figure this one out...

// h file
class bot {
  public:
    char const * name;
    void _init();
  };
// cpp file
bot::_init() {
  name = "deathwing"; }

I get error: |error: cannot convert 'const char [9]' to 'std::__cxx11::string* {aka std::__cxx11::basic_string<char>*}' in assignment|

Aucun commentaire:

Enregistrer un commentaire