上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 47 下一页
摘要: In this case, Box need access to Cup.func, AND Cup need access to Box.func, both of which are private because I don't want any other class to have acc... 阅读全文
posted @ 2014-11-21 17:13 rldts 阅读(210) 评论(0) 推荐(0) 编辑
摘要: http://stackoverflow.com/questions/27037744/why-doesnt-c-allow-rebinding-a-reference#1. The primary reason that the designer of C++ introduced referen... 阅读全文
posted @ 2014-11-20 18:39 rldts 阅读(440) 评论(0) 推荐(0) 编辑
摘要: Telescoping constructor: see Effective Java 2nd Edition Item 2If you want to use telescoping constructor but your compiler does not support c++11 stan... 阅读全文
posted @ 2014-11-20 17:12 rldts 阅读(338) 评论(0) 推荐(0) 编辑
摘要: Reference material:Thinking In C++ 2nd eidition chapter 5 section "Handle classes"If there's something need to be hidden from clients of the class (su... 阅读全文
posted @ 2014-11-19 18:50 rldts 阅读(251) 评论(0) 推荐(0) 编辑
摘要: main.cpp 1 #include "Stack.h" 2 3 #include 4 5 using namespace std; 6 7 class Box { 8 public: 9 Box():data(0), ID(num++) { cout data = b.data;... 阅读全文
posted @ 2014-11-19 18:16 rldts 阅读(362) 评论(0) 推荐(0) 编辑
摘要: 类似的问题还有: why can't class template use Handle Class Pattern to hide its implementation? || why there are linker problems (undefined reference) to my cl... 阅读全文
posted @ 2014-11-19 17:36 rldts 阅读(1111) 评论(0) 推荐(0) 编辑
摘要: 为什么会想到这个问题?因为我总是不自觉地将c++和java进行对比。java对这种情况的处理方式是constructor返回一个null,然后已经构造的objects交给Garbage Collector处理,那么c++没有Garbage Collector,会是怎么样的一种情况呢?为了找到这个问题... 阅读全文
posted @ 2014-11-19 01:09 rldts 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 以前喜欢这样组织文件:myproject/src/moduleA放moduleA的所有cpp文件myproject/include/moduleA放moduleA的所有h文件对moduleB.C.D...类似的处理,但是仍然容易有name clashes最近发现在使用上述文件组织方式的情况下,用na... 阅读全文
posted @ 2014-11-18 18:44 rldts 阅读(956) 评论(0) 推荐(0) 编辑
摘要: 参考资料:http://stackoverflow.com/questions/1306778/c-virtual-pure-virtual-explained验证代码:#include using namespace std;class Base {public: virtual void ... 阅读全文
posted @ 2014-11-18 17:00 rldts 阅读(6659) 评论(0) 推荐(0) 编辑
摘要: http://www.cplusplus.com/reference/ios/ios/operator_not/http://stackoverflow.com/questions/8117566/why-istream-object-can-be-used-as-a-bool-expression... 阅读全文
posted @ 2014-11-17 15:39 rldts 阅读(572) 评论(0) 推荐(1) 编辑
上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 47 下一页