Understanding How RWSockAddr Is Implemented
The
RWSockAddr keeps a reference-counted pointer to the real address, which is an object on the heap of some type derived from
RWSockAddrBase. The
RWSockAddr acts as a proxy for the heap object. When you call member functions on the
RWSockAddr, it forwards the calls to the object on the heap, which actually does the work.
Figure 9 shows the objects that are created by the following code.
RWSockAddr addr = "inet:net.roguewave.com:3010";
RWSockAddr addr2 = addr;
As the proxy objects go out of scope, the reference count is decremented. When no more objects refer to the object anRWInetAddr, it is automatically deleted.