<delect id="sj01t"></delect>
  1. <em id="sj01t"><label id="sj01t"></label></em>
  2. <div id="sj01t"></div>
    1. <em id="sj01t"></em>

            <div id="sj01t"></div>

            大自然的諺語

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

            有關于大自然的諺語260句

              已知類String的原型為:

            有關于大自然的諺語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個函數。

              標準答案:

              /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;

              }

            【大自然的諺語】相關文章:

            關于大自然的諺語12-31

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

            關于大自然的諺語320句12-12

            關于大自然的諺語200句12-10

            小學生關于認識大自然的諺語190句12-26

            立夏的諺語06-21

            冬日的諺語09-20

            植樹的諺語12-19

            英語諺語08-26

            <delect id="sj01t"></delect>
            1. <em id="sj01t"><label id="sj01t"></label></em>
            2. <div id="sj01t"></div>
              1. <em id="sj01t"></em>

                      <div id="sj01t"></div>
                      黄色视频在线观看