• <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 | 笑笑生
            曰曰摸天天摸人人看久久久| 欧美无乱码久久久免费午夜一区二区三区中文字幕 | 国产免费福利体检区久久| 国产福利电影一区二区三区久久久久成人精品综合 | 69久久精品无码一区二区| 久久综合久久综合久久综合| 99久久精品无码一区二区毛片 | 99久久精品国产一区二区| 久久久黄片| 伊人精品久久久久7777| 久久久噜噜噜久久中文福利| 久久天天躁狠狠躁夜夜av浪潮| 欧美国产成人久久精品| 精品熟女少妇av免费久久| 久久九色综合九色99伊人| 色诱久久久久综合网ywww| 久久精品国产免费一区| 久久久久99这里有精品10| 久久久久久狠狠丁香| 久久久久久国产精品美女| 久久精品国产黑森林| 99久久精品免费看国产| 国产精品99久久99久久久| 久久免费国产精品| 久久91这里精品国产2020| 久久Av无码精品人妻系列| 亚洲国产成人久久一区WWW| 99久久精品久久久久久清纯 | 久久久国产乱子伦精品作者| 久久综合偷偷噜噜噜色| 色狠狠久久综合网| 久久久久亚洲av毛片大| 93精91精品国产综合久久香蕉| 久久综合狠狠综合久久综合88| 怡红院日本一道日本久久 | 久久久久AV综合网成人| 久久久久亚洲av成人网人人软件 | 亚洲中文字幕无码久久2017| 无码乱码观看精品久久| 日批日出水久久亚洲精品tv| 久久夜色撩人精品国产|