26.3 The ADAPTER Pattern
- When you want to use an existing class, but its i/f doesn't match the
one you need
- Consider converting a string containing numerics ("235") to
an integer:
- string can't
- If digits were stored in a stream, great
- Hence, the istringstream class (chptr 12):
string s = "235";
istringstream istr(s);
int n;
s >> n;
// Now n is the integer 235
prev
|top
|next