using a class member to initialize a parent class
<p>I have a basic_iostream derived class like this:</p>

<pre><code>class MyStream : public std::basic_iostream&lt; char &gt;, 
                 private boost::noncopyable
{
public:
    explicit MyStream( SomeUsefulData&amp; data ) : 
        buffer_( data ),
        std::basic_iostream&lt; char &gt;( &amp;buffer_ )
    {
    };

    ~MyStream()
    {
    };

private:
    /// internal stream buffer
   MyStreamBuffer&lt; char &gt; buffer_;
}; // class MyStream
</code></pre>

<p>When I create an instance of it, though, I get a DataAbort exception.</p>

<pre><code>SomeUsefulData data;
MyStream stream( data );  // &lt;- Data Abort
</code></pre>

<p>If, however I change MyStream to heap allocate the MyStreamBuffer, it works fine:</p>

<pre><code>class MyStream : public std::basic_iostream&lt; char &gt;, 
                 private boost::noncopyable
{
public:
    explicit MyStream( SomeUsefulData&amp; data ) : 
        std::basic_iostream&lt; char &gt;( new MyStreamBuffer&lt; char &gt;( data ) )
    {
    };

    ~MyStream()
    {
        delete rdbuf();
    };
}; // class MyStream
</code></pre>

<p>Is it wrong to use a class member to initialize a parent class?</p>

<p>Thanks,
PaulH</p>
