Ray's playground

 

2011年3月27日

Item 22: Declare data members private(Effective C++)

摘要: Declare data members private. It gives clients syntactically uniform access to data, affords fine-grained access control, allows invariants to be enforced, and offers class authors implementation flexibility. protected is no more encapsulated than public. 阅读全文

posted @ 2011-03-27 20:56 Ray Z 阅读(181) 评论(0) 推荐(0) 编辑

Item 21: Don't try to return a reference when you must return an object(Effective C++)

摘要: Never return a pointer or reference to a local stack object, a reference to a heap-allocated object, or a pointer or reference to a local static object if there is a chance that more than one such object will be needed. 阅读全文

posted @ 2011-03-27 10:45 Ray Z 阅读(218) 评论(0) 推荐(0) 编辑

导航