作者ric2k1 (Ric)
看板EE_DSnP
标题Re: [问题] class的member function若有default ar …
时间Sat Dec 8 23:40:39 2007
※ 引述《popo4231 (小泰)》之铭言:
: 到底放哪边比较好呢
: 实际测试是不论放哪一边都不会error
: 只要不两边都放就好了
: 想知道老师比较常放哪边以及其原因
Default argument, be it for class member functions or regular global functions,
can only be specified in the "FIRST TIME" it appears in the program.
Therefore, it's better to specify it in the function prototype.
For class member functions,
it's better to be in class definition, i.e. .h file.
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.121.134.54
1F:推 Knossos:为什麽放在.cpp会过?那已经不是第一次出现了,不是吗? 12/09 16:33
2F:→ ric2k1:的确放在 cpp 会过, 他的规定是说 "不能 redefine"... 12/09 18:16
3F:→ ric2k1:不过我觉得在 .h 中没有定义然後在.cpp中才定义是蛮奇怪的 12/09 18:17