How can I create a static object member of class?
<p>I am fairly new to c++, especially in its techniques. My question is, how can I create a static object member of a class itself. What I mean is I declared a static member object inside a class. Example:</p>

<pre><code>CFoo:CFoo *pFoo[2] = {0};

class CFoo
{
   public: static CFoo *pFoo[2];
   public: CFoo(int a);
   public: CFoo *getFoo();
};
</code></pre>

<p>Now the problem is, how can I create the pFoo, like I want to create two static object pFoo,</p>

<pre><code>pFoo[0] = new CFoo(0);
pFoo[1] = new CFoo(1);
</code></pre>

<p>so that I can use the getFoo method to return one of the pFoo, like,</p>

<pre><code>CFoo *getFoo()
{
   return pFoo[0]; //or pFoo(1);
}
</code></pre>

<p>Thanks alot guys. Hope my questions are clear.</p>

<p>Thanks again in advance.
-sasayins</p>
