string name = "John Xhu"; cout << name << endl; string::size_type space_index = name.find(' '); cout << "Index of space: " << space_index << endl; if ( space_index == string::npos ) cout << "Not found" << endl; cout << "Initials: " << name[0] << name[space_index + 1] << endl;
string operator[](int ix) { .... }
+---------------+ |Type | | | |field: ___ | |field: ___ | +----------------+ |field: O------+------------->|Type | | | | | +---------------+ |field: ____ | +----------------+