Invariant
二月 8, 2006 on 1:06 pm | In c++ | No Comments這篇文章中 bjarne stroustrup 提及了何時不該用class, 以及如何判斷一個function 是否適合當作member function. 例如, find_next_sunday 就不適合放在'Date' class中.
這樣的概念, 在STL的 container - algorithm 中得到呼應. 把演算法丟到class中, 並不是物件導向.
在bjarne stroustrup 的"the c++ programming language" 也提過 Invariant(24.3.7.1), 但在這樣的大頭書中, 很多好的概念都隠藏在幾句簡單的話中, 容易被忽略. 常常是在日後某個時刻, 才想起當初簡單的話, 其實並不那麼簡單.....
寫c++筆記, 用來提醒自己, 一些好的概念, 是藏在那些書中.
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^