Jul 12, 2012
While Rajesh's answer is good, I would like to add the following. I heard someone say people use variables as if it is their Grand Father's property. The idea behind sharing variables is to conserve memory as in the string interning example. However, we do need to treat and represent each character as a separate entitiy. That amounts to very little when seen in the context of a huge document. By sharing those characters we are conserving memory.
Take an analogy with control derived from CWnd in MFC. Although, all controls are derived from CWnd, we still need to have different classes for CButton, CCheckBox and so on to represent the varied nature of each one. Likewise, each character should be treated separately. Even, in the CWnd derived objects - taking a lesson from the Flyweight patterns - one should try to optimize and share the variables as much as possible.
Hope it helps.
N. Murali Mohan