实例如下:
#include<iostream>
using namespace std;
class String;
ostream& operator<<(ostream &out, const String&s);
//引用计数器类
class String_rep
{
friend class String;
friend ostream& operator<<(ostream &out, const String&s);
public:
String_rep(const char *str )
:use_count(0)
{
if (str == NULL)
{
data = new char[1];
data[0] = '