C++筆記第一周(Boolan) 頭文件的防衛(wèi)式聲明: ``` #ifndef __Filename__ #define __Filename__ {body} #endif ``` 函數(shù)在class body里定義完成則默認(rèn)inline 函數(shù)支持參數(shù)支持默認(rèn)實(shí)參 相同的class各個object互為友元 參數(shù)為指針可以被改動偎窘。為const 引用不可以被改動 運(yùn)算符重載: 一般運(yùn)算符重載 A operator+(A&);//成員函數(shù) A operator-(A&); A operator*(A&); A operator/(A&); A operator%(A&); friend A operator+(A&,A&);//友元函數(shù) friend A operator-(A&,A&); friend A operator*(A&,A&); friend A operator/(A&,A&); friend A operator%(A&,A&); 關(guān)系運(yùn)算符重載: bool operator == (const A& ); bool operator != (const A& ); bool operator < (const A& ); bool operator <= (const A& ); bool operator > (const A& ); bool operator >= (const A& ); body之外定義類方法:inline