effective-c++

Effective C++ Item 23 Prefer non-member non-friend functions to member functions

a 夏天 提交于 2019-11-26 06:32:12
问题 While puzzling with some facts on class design, specifically whether the functions should be members or not, I looked into Effective c++ and found Item 23, namely, Prefer non-member non-friend functions to member functions. Reading that at first hand with the web browser example made some sense, however convenience functions( named the nonmember functions like this in the book) in that example change the state of the class, don\'t they? So, first question, should not they be members then?