R
Rene Ivon Shamberger
const std::string& someClass::someMethod(){ return some_string = "Bla Bla Bla"; }
.....
const std::string& myMethod(){
someClass obj;
return obj.someMethod();
}
Left as it is, this example will give me a warning stating that the return value from myMethod is a local value, but if I change the code to:
const std::string&
someClass::someMethod(){ return some_string = "Bla Bla Bla"; }
const std::string& myMethod(){
someClass obj;
std::string tmp = obj.someMethod(); /// New code
return temp;
}
The compiler complains saying that conversion from 'const string' to 'string' is not permited.
How can I remove this error?
.....
const std::string& myMethod(){
someClass obj;
return obj.someMethod();
}
Left as it is, this example will give me a warning stating that the return value from myMethod is a local value, but if I change the code to:
const std::string&
someClass::someMethod(){ return some_string = "Bla Bla Bla"; }
const std::string& myMethod(){
someClass obj;
std::string tmp = obj.someMethod(); /// New code
return temp;
}
The compiler complains saying that conversion from 'const string' to 'string' is not permited.
How can I remove this error?