亚洲春色中文字幕久久久-三上亚,一吻二脱三床四吻胸,国产真实伦对白视频全集,在线毛片观看,精品成品入口黄网,国产毛aⅴ片久久久,亚洲AV色香蕉一区二区三区老师,萧皇后A级艳片,色情日本视频更新,99久久亚洲精品日本无码

標(biāo)題: c++筆記 創(chuàng)建頭文件(不帶形參) [打印本頁]

作者: 51黑fan    時(shí)間: 2016-1-31 03:34
標(biāo)題: c++筆記 創(chuàng)建頭文件(不帶形參)
創(chuàng)建頭文件。(不帶形參)
cpp通過類名+::+函數(shù)名被頭文件鏈接。注意一定是類名+::!
函數(shù)代碼放在cpp下的相應(yīng)的函數(shù)名里,而頭文件中的只是函數(shù)名,只負(fù)責(zé)提供映射。
animal.cpp
#include "animal.h"
#include <iostream.h>
animal::animal()
{
        cout<<"hello"<<endl;
}
void animal::eat ()
{
  cout<<"shift"<<endl;
}

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

        void eat();
};
#endif




作者: 51黑fan    時(shí)間: 2016-1-31 03:35
        c++ 03 創(chuàng)建頭文件前的準(zhǔn)備 01
#include<iostream.h>
class animal
{
public:
        animal()
        {
                cout<<"animal construct"<<endl;
        }
        ~animal()
        {
                cout<<"construct animal"<<endl;
        }
        virtual void breath()  
        {
                cout<<"bubble2"<<endl;
        }
        void eat();//把主函數(shù)放在類外的方法
};
class fish:public animal
{
public:
        fish()
        {

        }
        ~fish()

        }
        void breath()
        {   
       
        }
};
void animal::eat()//函數(shù)類型,屬于那個(gè)類。把一個(gè)函數(shù)的實(shí)現(xiàn)放到類之外。
{

}

void main()
{

}





歡迎光臨 (http://www.denmoz.com/bbs/) Powered by Discuz! X3.1