Polymorphic Persistence Example
This example of polymorphic persistence contains two distinct programs. The first example polymorphically saves the contents of a collection to standard output (stdout). The second example polymorphically restores the contents of the saved collection from standard input (stdin). We divided the example to demonstrate that you can use persistence to share objects between two different processes.
If you compile and run the first example, the output is an object as it would be stored to a file. However, you can pipe the output of the first example into the second example:
 
firstExample | secondExample