Hey so im working on this problem I dont understand how im getting it wrong Im following the syntax just like how they have it explained. Can I get some pointers on what I am not getting.
Be careful with std::string vs. string here, that could cause you trouble. I’m not sure the provided error is all that helpful but all you want here is the declaration, not a definition, of your method.
Both your method declarations should look more like the following short example (under public)-
int member_func(pars);
They want you to write the definitions in a separate file.
In terms of namespaces, yes, string would not be directly available in this scope unless you added that namespace with using namespace.
As for an error I’m not sure what code you’re now using and what error you received. Have you changed your methods to just be declarations as per the second part of the previous post?
thanks I got I got the answer correct now but it doesn’t make sense though because when you learn variables earlier they dont even require that you write that and it still works fine if I were to write string name;
Unfortunately you can’t be sure what tests are going on in CC environment, there’s no guarantee the code is compiled or tested as there’s simpler routes to check just the contents of a file or similar. I’d advise trying to compile this on your own device and viewing the result for yourself if you want to be sure.
As a quick test-
# include <string>
int main() {
std::string test1;
// see where the error crops up
string test2;
return 0;
}