title: c++ error: call to non-static member function without an object argument
body: <p>I inherited some code that uses the class adapter pattern and I want to convert it to use the object adapter pattern.</p>
  
  <p>The custom class <code>string</code> is adapting <code>std::string</code>, and it's in the <code>MyString</code> namespace.<br>
  Here's  a snippet of how the code looks before I alter it.</p>
  
  <pre><code>// mystring.h
  namespace MyString
  {
  
  // StringInterface is the new (abstract) interface that the client will use.
  // Inheriting the implementation of std::string to build on top of it.
  class string : public StringInterface, private std::string
  {
    ...
  };
  
  }
  </code></pre>
  
  <hr>
  
  <pre><code>// mystring.cpp
  namespace MyString
  {
  
  ...
  
  string&amp; MyString::string::operator=(const string&amp; s) // copy assignment operator
  {
    if (this != &amp;s) std::string::operator=(s);
    return *this;
  }
  
  ...
  
  }
  </code></pre>
  
  <p>Once I remove the private inheritance of <code>std::string</code> (which I do because--correct me if I'm wrong--the object adapter pattern uses composition and not inheritance of the implementation), the statement <code>std::string::operator=(s);</code> causes the error "<strong>call to non-static member function without an object argument</strong>".</p>
  
  <p>So I'm not really sure how to accomplish this. It's my first time dealing with the adapter pattern (and C++ isn't my strongest language); maybe I'm overlooking something simple.</p>