c++学习笔记(3)
1.Triangular t=8;這句是調用單參數的構造函數
2.copy constructor VS copy assignment operator VS default memberwise initialization
如果有必要為某個class編寫copy constructor,那么同樣有必要為它編寫copy assignment operator
只要class設計者明確提供了copy assignment operator,它就會被用來取代default memberwise copy行為
3.const修飾符緊接于參數列表之后,而且函數聲明和函數定義比較同時指定const。const方法中如果修改了類成員會報錯。
4.非const對象可以調用非const方法和const方法,但const對象就只能調用const方法,不能調用非const方法。
5.非成員函數不容許使用const修飾符。
6.const也可以用來重載
int readIndex() const;
int readIndex();
7.const方法中可以修改mutable類型的成員。
8.this代表的是一個point
9.一個方法聲明為static時,在定義時不需要再制定static
10.對象可以調用static方法,類名也可以調用static方法。這個和java一致。.net和這有區別。
11.static成員變量的使用?????
12.Triangular_iterator& funName(){} 這里面定義的時候加了一個& 應該怎么理解????
13.所謂friend,具備了與class member function相同的訪問權限。
14.function object本質上還是調用object制定名稱的方法!這個名稱就是operator()
15.對于iostream的重載,為什么參數是兩個而不是一個。書中有解釋,但還是沒有看懂。???
16.pointer to member function VS pointer to non-member function
對pointer to member function的調用
(obj.*pnt)(); pnt是pointer to member function, obj是member function的類的對象
(objpnt->*pnt)(); pnt是pointer to member function, objpnt是member function的類的對象的指針
17.類成員變量在類創建時,并不是自動賦值為默認值!
轉載于:https://www.cnblogs.com/tianlanliao/p/4042107.html
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的c++学习笔记(3)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ios8 UITableView se
- 下一篇: U盘安装Linux CentOS 6.5