Is it possible not to include a class variable in a class header file?
<p>I want to hide an implementation in implementation file. If the object is not public, I don't want the object's header to leak everywhere my class is used.</p>

<p>Suppose I have header file <code>A.h</code> for my class <code>A</code>:  </p>

<pre><code>#include "Foo.h"

class A{
    private:
        Foo foo;
    public:
        do_stuff();
};
</code></pre>

<p>Now wherever I would include <code>A.h</code>, <code>Foo.h</code> also would be included. But I have no use for class <code>Foo</code> anywhere outside of class <code>A</code>. I would rather not have this <code>#include "Foo.h"</code> line. Is there any way to move the declaration of 'foo' variable inside the implementation <code>A.cpp</code>?  </p>

<p>I suspect one possible solution involves adding a layer of abstract class (interface analogy). Is it the best solution?    </p>

<p>Thank you.</p>
