## 26.4 The TEMPLATE METHOD Pattern (cont.)

Example - stream buffers

- Each (buffered) stream has an associated stream
- Characters sent to buffer
- When buffer is full, contents are written to its target (file, screen, etc.)
- More efficient
- `ofstream` and `ostringstream` differ only by the attached buffers:
  - `ofstream` has a `filebuf` object
  - `ostringstream` has a `stringbuf` object

prev |top |next