The context which is passed in is used in the same manner as in flattening, described earlier. For example, to resurrect the two instances created in the previous example:
// Resurrect a single instance
TPersistentClassA* A;
TMemory aStream;
A = (TPersistentClassA*) aStream.Resurrect();
// Resurrect multiple instances from the same stream
TPersistentClassD* D;
TPersistentClassA* A;
TMemory aStream;
TContext aContext;
if (!aStream>GetContext())
aStream>SetContext(&aContext);
D = (TPersistentClassD*) aStream.Resurrect(pneuma2);
A = (TPersistentClassA*) aStream.Resurrect(pneuma2);
if (aStream>GetContext() == &aContext)
aStream>SetContext(NIL);
In the case of saving and restoring sets of instances, the order of resurrection must follow the order of flattening exactly.