Implementation String class with exception handling and reference counting