|
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ù)類型,屬于那個類。把一個函數(shù)的實現(xiàn)放到類之外。
{
}
void main()
{
}
|
|