class 裡的 function 放裡面還外面?

看板C_and_CPP (C/C++)作者 (風樹)時間16年前 (2009/06/10 12:28), 編輯推噓3(301)
留言4則, 4人參與, 最新討論串1/2 (看更多)
感覺 declare and define 都放 class 內有點雜亂 define 拉出來又覺得有點和 class 脫離 請問大家是怎麼放的? 感謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.204.40.189

06/10 12:31, , 1F
declare放header,define放source file
06/10 12:31, 1F

06/10 12:54, , 2F
有用模板的話例外
06/10 12:54, 2F

06/10 12:59, , 3F
#include "a.h" a.h:class a {...}; a.cpp: a::a() {..} ?
06/10 12:59, 3F

06/10 12:59, , 4F
define 放 class 內還會隱含 inline 的意思
06/10 12:59, 4F
文章代碼(AID): #1ABpPny- (C_and_CPP)
文章代碼(AID): #1ABpPny- (C_and_CPP)