---
# System prepended metadata

title: class成員周期

---

class的constructor和destructor之生命週期
===
employee正常初始化(有&)
---
>![image](https://hackmd.io/_uploads/S1_v6FsXT.png =90%x)

>![image](https://hackmd.io/_uploads/HkiYTYiXa.png =60%x)

總共
---
>>==4個constructor==
>>==8個destructor==
***

employee正常初始化(沒有&)
---
>![image](https://hackmd.io/_uploads/BJhUq5imT.png =90%x)

>![image](https://hackmd.io/_uploads/rkBs5cjXT.png =60%x)

總共
---
>>==4個constructor==
>>==8+4個destructor==

***

employee使用"="初始化(有&)
---
>![image](https://hackmd.io/_uploads/rkVHo9imp.png =90%x)

>![image](https://hackmd.io/_uploads/S1CHs9oQT.png =60%x)

總共
---
>>==4+4個constructor==
>>==8個destructor==

***

employee使用"="初始化(沒有&)
---
>![image](https://hackmd.io/_uploads/SyPCi5iQT.png =90%x)


>![image](https://hackmd.io/_uploads/SJs2j9oXp.png =60%x)

總共
---
>>==4+4個constructor==
>>==8+4個destructor==

***
|  constructor   | 正常初始化 | 等號初始化 |
| --- | ----- | ----- |
| 有&  |  4   |  4+4   |
| 無&  |  4   |  4+4   |

|  destructor   | 正常初始化 | 等號初始化 |
| --- | ----- | ----- |
| 有&  |  8   |  8   |
| 無&  |  8+4   |  8+4   |