title: Declare Private Variables in C++
body: <p>I want to create some private variables, but when i compile the program i get an error. If I move the variables above the class SimpleOpenNIViewer than it works. </p>
  
  <p>This is the error Messages:
  /Workspace/virtual-reality/main.cpp:16:56: error: expected identifier before ‘new’
           PointCloud::Ptr cloud_previous2 (new PointCloud);</p>
  
  <p>This is how I have written the code. Can anyone tell me why this doesnt work?        </p>
  
  <pre><code>class SimpleOpenNIViewer
       {
          private:
              PointCloud&lt;PointXYZRGBA&gt;::Ptr cloud_previous2 (new PointCloud&lt;PointXYZRGBA&gt;);
              PointCloud&lt;PointXYZRGBA&gt;::Ptr cloud_previous1 (new PointCloud&lt;PointXYZRGBA&gt;);
              PointCloud&lt;PointXYZHSV&gt;::Ptr cloud_HSVPrev2(new PointCloud&lt;PointXYZHSV&gt;);
              PointCloud&lt;PointXYZHSV&gt;::Ptr cloud_HSVPrev1(new PointCloud&lt;PointXYZHSV&gt;);
              PointCloud&lt;PointXYZHSV&gt;::Ptr cloud_HSVCurr(new PointCloud&lt;PointXYZHSV&gt;);
  </code></pre>