hi i'm a little confused about resolution operator (i think thats the name in english).Code:::
i can use the string class usng it that way:
so the question:Code:#include <iostream> using namespace std; //can use any string class function without problem #include<string> using std::string; int main() { string my_name = "TerraKota"; //need to know my_name size, so i use the size() method. cout << "You name is: " << my_name.size() << "chars long"; //now if i need to store my name size into a variable i must //declare a size_type: size_type nameSize = my_name.size(); //ok here the compiler generates an error: //C:\programas c++\ejer17_6\main.cpp(21) : error C2065: 'size_type' : undeclared identifier// //but if i use : string:: size_type nameSize = my_name.size(); //everything is fine. return 0; }
if I include
<string>
and use the string class
using std::string
why i need to use string::size_type everytime i need to use the return value of the size() method?
maybe im confused about namespaces etc, any help?
and please excuse my poor english



LinkBack URL
About LinkBacks



I used to be an adventurer like you... then I took an arrow to the knee.