• <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 閱讀(320) 評論(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 | 笑笑生
            色综合久久综合网观看| 99久久精品无码一区二区毛片| 国产精品嫩草影院久久| 99久久亚洲综合精品网站| 精品久久久久久无码免费| 99久久这里只精品国产免费| 色偷偷88888欧美精品久久久| 久久99精品久久久久久hb无码| 国产精品日韩深夜福利久久| 武侠古典久久婷婷狼人伊人| 久久免费的精品国产V∧| 爱做久久久久久| 奇米综合四色77777久久| 久久精品国产亚洲AV不卡| 日韩人妻无码精品久久久不卡| 久久精品国产99久久香蕉| 韩国免费A级毛片久久| 四虎影视久久久免费观看| 人人狠狠综合久久亚洲88| 97香蕉久久夜色精品国产| 久久激情五月丁香伊人| 久久这里只有精品首页| 久久久噜噜噜久久熟女AA片| 久久综合九色综合久99| 女人香蕉久久**毛片精品| 久久精品aⅴ无码中文字字幕不卡 久久精品aⅴ无码中文字字幕重口 | 日韩精品久久久肉伦网站| 欧洲国产伦久久久久久久| 国内精品久久久久国产盗摄| 久久国产色AV免费观看| 久久精品国产清高在天天线| 嫩草伊人久久精品少妇AV| 亚洲AV无一区二区三区久久| 亚洲七七久久精品中文国产| 国产精品美女久久久久av爽| 四虎国产精品免费久久5151| 高清免费久久午夜精品| 久久99国产精品久久99| 久久se精品一区二区影院 | 一本一道久久a久久精品综合 | 国产激情久久久久久熟女老人 |