上一页 1 2 3 4 5 6 7 8 ··· 23 下一页
摘要: This suggests the real meaning of "as long as possible" in this Item’s title. Not only should you postpone a variable's definition until right before 阅读全文
posted @ 2021-09-09 16:58 MyCPlusPlus 阅读(58) 评论(0) 推荐(0) 编辑
摘要: To swap the values of two objects is to give each the other's value. By default, swapping is accomplished via the standard swap algorithm. Its typical 阅读全文
posted @ 2021-09-09 16:13 MyCPlusPlus 阅读(53) 评论(0) 推荐(0) 编辑
摘要: You might start your Rational class this way: class Rational { public: Rational(int numerator = 0, // ctor is deliberately not explicit; int denominat 阅读全文
posted @ 2021-09-07 18:25 MyCPlusPlus 阅读(63) 评论(0) 推荐(0) 编辑
摘要: Imagine a class for representing web browsers. Among the many functions such a class might offer are those to clear the cache of downloaded elements, 阅读全文
posted @ 2021-09-07 17:33 MyCPlusPlus 阅读(113) 评论(0) 推荐(0) 编辑
摘要: If everything in the public interface is a function, clients won't have to scratch their heads trying to remember whether to use parentheses when they 阅读全文
posted @ 2021-09-07 17:02 MyCPlusPlus 阅读(30) 评论(0) 推荐(0) 编辑
摘要: Consider a class for representing rational numbers, including a function for multiplying two rationals together: class Rational { public: Rational(int 阅读全文
posted @ 2021-09-07 16:35 MyCPlusPlus 阅读(66) 评论(0) 推荐(0) 编辑
摘要: By default, C++ passes objects to and from functions by value (a characteristic it inherits from C).The end result is that passing an object by value 阅读全文
posted @ 2021-09-07 15:42 MyCPlusPlus 阅读(113) 评论(0) 推荐(0) 编辑
摘要: How do you design effective classes? First, you must understand the issues you face. Virtually every class requires that you confront the following qu 阅读全文
posted @ 2021-09-07 11:18 MyCPlusPlus 阅读(53) 评论(0) 推荐(0) 编辑
摘要: Developing interfaces that are easy to use correctly and hard to use incorrectly requires that you consider the kinds of mistakes that clients might m 阅读全文
posted @ 2021-09-07 10:50 MyCPlusPlus 阅读(43) 评论(0) 推荐(0) 编辑
摘要: Suppose we have a function to reveal our processing priority and a second function to do some processing on a dynamically allocated Widget in accord w 阅读全文
posted @ 2021-09-03 09:37 MyCPlusPlus 阅读(32) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 23 下一页