Controlling the Scope of Object Reference Resolution
Every time an object is inserted into an object stream, a context is established for the resolution of object references. For instance, the following code establishes a scope that matches the scope of the object cat. Object references contained within cat will be matched up as required.
 
// examples\serial\advanced\catanddog.h
 
class cat
{
RW_DECLARE_VIRTUAL_STREAM_FNS(cat)
public:
cat() { }
 
virtual ~cat() { }
 
cat(const RWCString color) : color_(color) { }
private:
RWCString color_;
};
 
cat* yellow_cat = new cat("yellow");
 
out << yellow_cat