Preferring non-member non-friend functions to member functions
<p>This question title is taken from the title of item #23 in Effective C++ 3rd Edition by Scott Meyers.  He uses the following code:</p>

<pre><code>class WebBrowser {
public:
    void clearCache();
    void clearHistory();
    void removeCookies();

    //This is the function in question.
    void clearEverything();
};

//Alternative non-member implementation of clearEverything() member function.
void clearBrowser(WebBrowser&amp; wb) {
    wb.clearCache();
    wb.clearHistory();
    wb.removeCookies();
};
</code></pre>

<p>While stating that the alternative non-member non-friend function below is better for encapsulation than the member function clearEverything().  I guess part of the idea is that there are less ways to access the internal member data for the WebBrowser if there are less member functions providing access.</p>

<p>If you were to accept this and make functions of this kind external, non-friend functions, where would you put them?  The functions are still fairly tightly coupled to the class, but they will no longer be part of the class.  Is it good practice to put them in the class's same CPP file, in another file in the library, or what?</p>

<p>I come from a C# background primarily, and I've never shed that yearning for everything to be part of a class, so this bewilders me a little (silly though that may sound).</p>
