如图变换,且对于指向同一空间的String进行计数
代码例如以下:
#include <iostream>
using namespace std;
class String; //提前声明
class String_rep //定义类String_rep
{
friend class String; //友元
public:
String_rep(const char *str=NULL):use_count(0) //构造
{
if(str == NULL)
{
m_data = new char[1];
m_data[0] = '