Instead, the implementation details are placed in a second class, called the representation , or simply, the rep , for short. The actual class contains a pointer to the rep. Classes which have a pointer to another class which contains the actual implementation are called handle classes. When a handle object receives a message to perform one of its operations, the message is forwarded to the rep for actual processing. Handles are a very useful programming technique and should be a part of every object-oriented programmers toolbox.
Handles do have a few disadvantages, however.
They increase the size of the object by the addition of the rep pointer. Each time an operation is invoked by the handle class through the rep pointer, a little more time is spent performing the extra indirection. Also, functions in the handle class that use any members of the rep class cannot be made inline, since the definition of the rep is not provided. One strategy is to use handles during development to minimize the impact of changes on client code. Later, when it can be shown that the differences in size or speed is significant, the handle can be replaced by a more concrete class that does not use a handle.