• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            穩定盈利的期貨交易方法-量化趨勢交易

            alantop -專業量化投資者

            愛好:量化投資,逆向工程,滲透
            隨筆 - 595, 文章 - 0, 評論 - 921, 引用 - 0
            數據加載中……

            通過user_string類,來看如何撰寫構造函數。

            #include <string.h>
            #include <stdio.h>

            class user_string
            {
            public :
            ?user_string();
            ?user_string(const char *src);
            ?user_string(const user_string &other);
            ?user_string &operator = (const user_string &other);
            ?
            ?~user_string();
            ?void show();
            private:
            ?char *m_pdata;
            };

            user_string::user_string()
            {
            }

            user_string::user_string(const user_string &other)
            {

            }

            user_string::user_string(const char*src)
            {
            ?if ( src == NULL )
            ?{
            ??m_pdata = new char[1];
            ??m_pdata[0] = '\0';
            ?}
            ?else
            ??m_pdata = new char [strlen(src) + 1];
            ??strcpy(m_pdata, src);
            }

            user_string::~user_string()
            {
            ?delete []m_pdata;
            }

            user_string & user_string::operator = (const user_string &other)
            {
            ?if (?this == &other )
            ??return *this;
            ?
            ?delete []m_pdata;

            ?m_pdata = new char[strlen(other.m_pdata) + 1];
            ?strcpy(m_pdata, other.m_pdata);
            ?return * this;
            }


            void user_string::show()
            {
            ?printf("%s", m_pdata);
            }

            void main()
            {
            ?user_string a("123");
            ?user_string b("456");
            ?b = b;
            ?b = a;
            ?//b = a;
            ?
            }

            posted on 2006-06-03 12:06 AlanTop 閱讀(318) 評論(2)  編輯 收藏 引用 所屬分類: C++

            評論

            # re: 通過user_string類,來看如何撰寫構造函數。  回復  更多評論   

            user_string & user_string::operator = (const user_string &other)
            {
            if ( m_pdata == other ) //這里錯了。
            return *this;

            delete []m_pdata;

            m_pdata = new char[strlen(other.m_pdata) + 1];
            strcpy(m_pdata, other.m_pdata);
            return * this;
            }
            2006-06-03 13:15 | 任我行

            # re: 通過user_string類,來看如何撰寫構造函數。  回復  更多評論   

            if ( m_pdata == other ) //這里錯了
            2006-06-03 13:32 | 笑笑生
            久久WWW免费人成—看片| 一本久久a久久精品亚洲| 亚洲国产精品人久久| 精品人妻伦九区久久AAA片69| 欧美日韩精品久久久久| 久久婷婷五月综合色奶水99啪| 久久久精品人妻一区二区三区蜜桃 | 亚洲国产另类久久久精品| 国产一级持黄大片99久久| 亚洲国产精品成人AV无码久久综合影院 | 久久免费观看视频| 久久婷婷五月综合国产尤物app| 91精品国产色综久久| 久久天天躁狠狠躁夜夜躁2O2O| 99久久婷婷国产一区二区| 欧美丰满熟妇BBB久久久| 欧美伊人久久大香线蕉综合69| 久久99热狠狠色精品一区| 久久人与动人物a级毛片| 久久国产精品一区| 91精品婷婷国产综合久久| 精品国产一区二区三区久久久狼 | 人妻无码中文久久久久专区| 久久久精品无码专区不卡| 久久久中文字幕| 久久99亚洲网美利坚合众国| 亚洲午夜久久久久久久久久| 亚洲精品97久久中文字幕无码| 久久艹国产| 久久99亚洲综合精品首页| 亚洲午夜久久影院| 狠狠久久综合| 久久男人中文字幕资源站| 日韩十八禁一区二区久久| 亚洲国产精品狼友中文久久久| 久久精品亚洲福利| 女同久久| 亚洲精品乱码久久久久久自慰 | 国产精品99久久久精品无码| 亚洲一区精品伊人久久伊人| 久久人人爽人人爽人人片AV东京热|