一、選擇
1、運算符重載:(1)不可重載:. ? ?.* ? :: ? ? ?: ? sizeof
(2)只成員函數:=、[]、()、->
ps:=和[]需要加&,=返回類,[]返回中括號內數的類型
如:Integer &operator =(Integer & i);
(3)只友元:<< ? >>
例:friend ostream &operator <<(ostream &output,Integer &i);
ostream &operator <<(ostream &output,Integer &i)
{
? ? ? ? output<<"neirong"<<endl;
? ? ? ? return output;
}
二、編程
1、類:注意構造函數和析構函數的使用;
2、運算符重載:注意插入和提取運算符。
3、多態:注意虛函數和純虛函數:
Animal *p;
Cat c(a,b);
p=&c;
p->show();
4、文件:六步走!注意構造函數可能用于讀文件(count),析構函數用于寫文件(循環)
三、綜合題
1、調用拷貝構造函數:傳值、返回的是類的類型(注意匿名對象的析構)