iT邦幫忙

鐵人檔案

2023 iThome 鐵人賽
回列表
自我挑戰組

Effective C++ 讀書筆記 系列

目標是閱讀這本 C++的經典書籍─Effective C++: 55 Specific Ways to Improve Your Programs and Designs,並同步紀錄其中的準則。

鐵人鍊成 | 共 30 篇文章 | 0 人訂閱 訂閱系列文 RSS系列文
DAY 11

[Day 11] Declare destructors virtual in polymorphic base classes

前言 今天的守則也跟前兩則有點關係,直接來看看~ 記得把多型的base class destructor設為virtual! 這個守則是: Declare d...

2023-09-26 ‧ 由 daipeinew 分享
DAY 12

[Day 12] Prevent exceptions from leaving destructors

前言 今天這則守則非常單純好理解,就來輕鬆一下吧! 別讓destructor丟exception 這個守則是: Prevent exceptions from...

2023-09-27 ‧ 由 daipeinew 分享
DAY 13

[Day 13] Never call virtual functions during construction and destruction

前言 轉眼間第二章的守則也介紹了一半,今天進入的則是第9條守則。也可以不時去回顧一下前面的守則:[Day 1] 前言。 不要在constructor, dest...

2023-09-28 ‧ 由 daipeinew 分享
DAY 14

[Day 14] Have assignment operators return a reference to *this

前言 今天的守則很簡單,可以直接來看看。 assignment operator請return *this 這個守則是: Have assignment op...

2023-09-29 ‧ 由 daipeinew 分享
DAY 15

[Day 15] Handle assignment to self in operator= (1)

前言 到了30天的中點啦!今天要介紹的是第11條守則,看來這個月結束之後可以紀錄到22條守則左右,繼續加油吧! 我們需要考慮指派給自己的情形 今天的守則跟昨天一...

2023-09-30 ‧ 由 daipeinew 分享
DAY 16

[Day 16] Handle assignment to self in operator= (2)

前言 接續昨日([Day 15] Handle assignment to self in operator= (1))內容,我們看到需要確保self-assi...

2023-10-01 ‧ 由 daipeinew 分享
DAY 17

[Day 17] Copy all parts of an object (1)

前言 終於到了第二章的最後一個守則了!來看看吧! 記得copy所有東西 今天的守則專注於copy的部分,包含copy constructor跟copy assi...

2023-10-02 ‧ 由 daipeinew 分享
DAY 18

[Day 18] Copy all parts of an object (2)

前言 接續昨天的內容,還剩最後一點補充。然後順帶偷渡一點第三章─ Resource Management 的前言介紹XD copying function不要混...

2023-10-03 ‧ 由 daipeinew 分享
DAY 19

[Day 19] Use objects to manage resources

前言 終於要開始第三章了~ 第三章總共有5個守則,馬上就來看看第一則吧! RAII- Resource Acquisition Is Initializatio...

2023-10-04 ‧ 由 daipeinew 分享
DAY 20

[Day 20] Think carefully about copying behavior in resource-managing classes

前言 今天繼續來看resource managing系列的第二個守則,看看開始用物件來管理resource後,還有哪些注意事項。 更多的RAII 今天的守則是:...

2023-10-05 ‧ 由 daipeinew 分享