Passing dependency to wrapper object via its constructor
<p>I have the following test:</p>

<pre><code>TestGet(): _interface(), _db(_interface)
{
    _interface.get = mockGet;
}
</code></pre>

<p>which is used when testing this class:</p>

<pre><code>class DB: public IDB
{
public:
   explicit DB(Interface_T&amp; interface):
     _interface(interface)
   {
   }

   ...

private:
   Interface_T _interface;
};
</code></pre>

<p>Interface_T is a C interface implemented in a struct and passed to me from a C api. I wish to use the DB class as a wrapper around the C interface. </p>

<p>Notice however that DB copies the interface object to its member _interface. Therefore the line:</p>

<pre><code>_interface.get = mockGet;
</code></pre>

<p>has no effect from the DB objects point of view although this was the intention when I wrote the test class. How would you rewrite TestGet() to remedy this error? How would you present to the client of the DB class that it copies the value passed to it?</p>
