mercredi 4 avril 2018

combining a constant string with a non constant string in c++

So I have a constant string field and I am trying to set it equal to a non-constant string in my constructor class. Right now I have it written like:

constant string pizza;

Store::Store(string topping){
 pizza = topping;
}

When I do this though I receive a:

"passing ‘const string {aka const std::__cxx11::basic_string}’ as ‘this’ argument discards qualifiers [-fpermissive]"

What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire