日本无码中文字幕片|日本精品在线观看无码视频|国产精品免费啪啪|Av无码一区二区|亚洲在线黄片免费观看|亚洲日韩中文字幕在线观看|熟女激情乱伦在线观看a黄片|成年人观看毛片网址|AV色色色色日韩性草|国产高清无码免费

大自然的諺語

時間:2025-08-24 13:57:22 秀雯 諺語 我要投稿

有關(guān)于大自然的諺語260句

  已知類String的原型為:

有關(guān)于大自然的諺語260句

  class String

  {

  public:

  String(const char *str = NULL); /pic/p>

  String(const String &other); /pic/p>

  ~ String(void); /pic/p>

  String & operate =(const String &other); /pic/p>

  private:

  char *m_data; /pic/p>

  };

  請編寫String的上述4個函數(shù)。

  標(biāo)準答案:

  /pic/p>

  String::~String(void) /pic/p>

  {

  delete [] m_data;

  /pic/p>

  }

  /pic/p>

  String::String(const char *str) /pic/p>

  {

  if(str==NULL)

  {

  m_data = new char[1]; /pic/p>

  *m_data = ‘\0’;

  }

  else

  {

  int length = strlen(str);

  m_data = new char[length+1]; /pic/p>

  strcpy(m_data, str);

  }

  }

  /pic/p>

  String::String(const String &other) /pic/p>

  {

  int length = strlen(other.m_data);

  m_data = new char[length+1]; /pic/p>

  strcpy(m_data, other.m_data);

  }

  /pic/p>

  String & String::operate =(const String &other) /pic/p>

  {

  /pic/pic/p>

  if(this == &other)

  return *this;

  /pic/pic/p>

  delete [] m_data;

  /pic/pic/p>

  int length = strlen(other.m_data);

  m_data = new char[length+1]; /pic/p>

  strcpy(m_data, other.m_data);

  /pic/pic/p>

  return *this;

  }

【大自然的諺語】相關(guān)文章:

關(guān)于大自然的諺語12-31

大自然的英語諺語80句07-16

關(guān)于大自然的諺語320句12-12

關(guān)于大自然的諺語200句12-10

小學(xué)生關(guān)于認識大自然的諺語190句12-26

立夏的諺語06-21

冬日的諺語09-20

植樹的諺語12-19

英語諺語08-26