title: Passing pointers to threads without being out of scope
body: <p>I am given a pre-defined .lib files of pre-defined classes/functions.</p>
  
  <p>I will need to create a:</p>
  
  <pre><code>    Cdefined *p = new Cdefined;
      p-&gt;Init();
  </code></pre>
  
  <p>in the main() program to init my class object before calling my thread.</p>
  
  <p>However I realised that in each of my threads, I will have to call:</p>
  
  <pre><code>    p-&gt;doProcess(); 
  </code></pre>
  
  <p>to run a segment of the code, for each of the threads. </p>
  
  <p>However, this function will not work unless i call <code>p-&gt;Init()</code>.</p>
  
  <p>Since now I have at least 2 scopes of p (one created in <code>main()</code>, and N of them in N threads), how do I go about designing my thread, such that the class can be passed in without scope errors? [My constrain is that <code>p-&gt;Init()</code> has to be called in <code>main()</code>]</p>