Handle-Body Mechanics
The basic mechanics of handle-body can be visualized with the diagrams that follow. Figure 35 shows how the handle points and forwards calls to the body.
Figure 35 – Model of interaction between handle and body classes
When you use a copy constructor to create one handle from another, for example when passing a handle as a parameter, the new handle is bound to the same body instance, if any, pointed-to by the other handle. Figure 36 shows the result.
Figure 36 – Copy construction of handle-body classes
Similarly, assigning one handle to another causes the left-hand instance to detach from its current representation, if any, and then binds it to the same body instance pointed to by the right-hand instance. Figure 37 shows how assignment works in the same bicycle example.
Figure 37 – Assignment of handle-body classes