[問題] function 如何傳入或回傳reference NULL
很多人都會建議 多用 reference 少用 point
可是當function 得回傳值或是 傳入值 是 NULL 時
要如何傳 NULL 的參數給 function 或是 回傳 NULL的reference?
雖然可以 int* aaa=NULL;
int &bbb=*aaa;
但感覺很多此一舉 有更簡便的方式嗎?
感覺 reference 不適合處理 NULL的狀況?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 218.35.163.53
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1450079904.A.DBF.html
※ 編輯: yhn0tgb60 (218.35.163.53), 12/14/2015 16:18:10
推
12/14 16:37, , 1F
12/14 16:37, 1F
而且我最近連 new object 都改用reference 接
好像有點沒必要.......
※ 編輯: yhn0tgb60 (218.35.163.53), 12/14/2015 17:13:25
→
12/14 17:31, , 2F
12/14 17:31, 2F