C++ pass by pointer
<p>Guys, I am very new to c++. I have just wrote this class:</p>

<pre><code>class planet
{
public:
 float angularSpeed;
 float angle;
};
</code></pre>

<p>Here is a function trying to modify the angle of the object:</p>

<pre><code>void foo(planet* p) 
{
  p-&gt;angle = p-&gt;angle + p-&gt;angularSpeed;
}

planet* bar = new planet();
bar-&gt;angularSpeed = 1;
bar-&gt;angle = 2;
foo(bar);
</code></pre>

<p>It seem that the angle in bar didn't change at all.</p>
