I've always been baffled by this as I haven't paid much attention to it but now that I am, I'm reliving the irritability (is that a word?) of my past pains.
Strings in C++...
I've seen tutorials and books that say stuff like this as for the declaration of a string:
Then I've seen this as an initialization for a string:Code:#include <string> string str1;
Now why is it I'm seeing this as examples from tutorials but when I do this in my code, all the time, I'll get this nice little error from the compiler (and I quote):Code:str1("Hello"); str1 = "Hello";
This is a SECTION of code where the compiler complains:'string' does not name a type
Could someone tell me why this is happening? Thanks in advanceCode:typedef class item{ private: ITEM_TYPE type; string name; //right here!!!!! string desc; //and here too!!!! int buyPrice; int sellPrice; BITMAP *sprite;




Reply With Quote