solved.

...
Last edited on
You named your class string.

You are also including the <string> header, which defines another class named std::string. It starts with "std::" because it's in the std namespace.

When you say using namespace std; you are telling the compiler to take everything in the std namespace and dump it into the global namespace. Thus, std::string becomes string, conflicting with your class with the same name. Hence the ambiguity errors.

The compiler is getting confused because you tell it you want a string and there are two different classes with that name.... it doesn't know which one you mean.

This is why you should avoid "using namespace std". The namespace is there to prevent this kind of thing from happening.
Last edited on
So if I understand what you are saying, you're telling me that I should change the name of my class to something different, drop the using namespace std; but when I do this I then have to put std:: in front of my cout and cin commands.

From there if I try to use the getline() I know I need to do std::getline(input) this then gives me another error so I tried adding it to look like std::getline(std:cin,input) and this give me and error saying it expects 3 arguments -2 provided.
snipejawnkid7 wrote:
std::getline(std:cin,input)

it's double ::.
Whoops that was just a typo on my end with the double colon it still gives me that error.
Topic archived. No new replies allowed.