Design problems in C++
<p>I have a raw buffer which contains number of different structs(which I couldn't modify) which I planned to wrapped inside a class like below so that I could invoke the virtual Process based on the concrete type.</p>

<pre><code>class Base{
public:
  virtual void Process();
};

class DerivedA : public Base {
private:
 char* structBuf;

public:
  virtual void Process();
}

class DerivedB : public Base {
private:
 char* structBuf;
public:
  virtual void Process();
}

int main()
{
 for(int i = 0 ; i &lt; 10; i++)
 {
  Base* a = FactoryObject();
  a-&gt;Process();
 }
}
</code></pre>

<p>My question is some of the objects depent on each other. For example, let say <code>derivedA</code> data would be processed first and <code>derivedB</code> needs the data from <code>derivedA.</code></p>

<ul>
<li><p>How or where could I store the <code>derivedA</code> object in <code>main()</code> so that I could utilize it in <code>derivedB?</code></p></li>
<li><p>How could I know which objects from factory is <code>derivedA</code> so that I could store it?</p></li>
</ul>
