Virtual Steams Recap
In this section, you have seen how an object can be stored to and recovered from a stream without regard for the final destination of the bytes of that stream, whether memory or disk. You have also seen that you need not be concerned with the final formatting of the stream, whether ASCII or binary.
You can also write your own specializing virtual stream class, much like RWpostream and RWpistream. The great advantage of the virtual streams facility is that, if you do write your own specialized virtual stream, you don't have to modify any of the code of the client classes — you just use your stream class as an argument to:
 
RWvostream& operator<<(RWvostream&, const ClassName&);
RWvistream& operator>>(RWvistream&, ClassName&);
In addition to streaming to/from virtual streams, objects of these types can be streamed to/from RWFile objects. Although RWFile is less sophisticated than the stream I/O classes, this form of storage and retrieval is slightly faster because polymorphism, hence costly dispatching, is not involved.