面向對象高級編程(下)-- 第一週學習筆記(Boolan)

1,轉換函數(conversion function)算法

operator double() const
{
return (double)(m_numerator / m_denominator);
}

  對於一個分數,若是與整數或浮點數進行運算,轉換成小數或者浮點數是合理的。函數

  沒有返回類型
2,non-explicit-one-argument ctor
  一個分數包括分子和分母,當爲整數時,分母爲一,因此構造函數的分母的默認值一般爲1,這個時候若是一個分數加一個整數,編譯器能夠將整數轉換成分數,再調用+運算符重載
3,conversion function vs. non-explicit-one-argument ctor
  同時存在會出錯
4,explicit-one-argument ctor
  explicit意味着當碰到一個整型數據將不能自動轉換成分數
5,智能指針(pointer-like classes)
6,仿函數(function-like classes)
7,namespace
8,類模板(class template)
9,函數模板(function template)
10,成員模板(member template)
11,模板特化(specialization)
12,模板偏特化(partial specialization)
  個數的偏
  範圍的偏
13,模板模板參數(template template parameter)
14,C++標準庫
  容器
  算法
  迭代器
  仿函數
15,數量不定的模板參數(variadic templates)
16,auto
17,ranged-base for
18,reference
  reference一旦初始化就不能表明其餘的了,一女不能侍二夫
19,對象模型spa

相關文章
相關標籤/搜索