在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > C++中創(chuàng)建頭文件的方法

            C++中創(chuàng)建頭文件的方法

            作者: 時(shí)間:2016-12-01 來源:網(wǎng)絡(luò) 收藏
            創(chuàng)建頭文件。(不帶形參)

            cpp通過類名+::+函數(shù)名被頭文件鏈接。注意一定是類名+::!
            函數(shù)代碼放在cpp下的相應(yīng)的函數(shù)名里,而頭文件中的只是函數(shù)名,只負(fù)責(zé)提供映射。
            animal.cpp
            #include "animal.h"
            #include
            animal::animal()
            {
            cout<<"hello"<}
            void animal::eat ()
            {
            cout<<"shift"<}

            animal.h
            //頭文件只寫函數(shù)名,提供鏈接地址。
            #ifndef ANIMAL_H_H
            #define ANIMAL_H_H
            class animal
            {
            public:
            animal();

            void eat();
            };
            #endif

            本文引用地址:http://www.biyoush.com/article/201612/324422.htm

            -------------------------------------------------------------------------------------

            如果不創(chuàng)建頭文件就要寫這么長的代碼 可讀性很差#include

            class animal
            {
            public:
            animal()
            {
            cout<<"animal construct"<
            }
            ~animal()
            {
            cout<<"construct animal"<
            }
            virtual void breath()
            {
            cout<<"bubble2"<
            }
            void eat();//把主函數(shù)放在類外的方法
            };
            class fish:public animal
            {
            public:
            fish()
            {
            }
            ~fish()
            }
            void breath()
            {
            }
            };
            void animal::eat()//函數(shù)類型,屬于那個(gè)類。把一個(gè)函數(shù)的實(shí)現(xiàn)放到類之外。
            {
            }
            void main()
            {
            }


            關(guān)鍵詞: C++頭文

            評論


            相關(guān)推薦

            技術(shù)專區(qū)

            關(guān)閉