C++ Assigning float to member data
<p>I have a custom Vector class that contains an x, y, and z. These are stored in an int array called <code>data</code>. So basically <code>data[0] = x</code>, <code>data[1] = y</code>, and <code>data[2] = z</code>. Simple enough.</p>

<p>I am tasked with writing a function that allows the following:</p>

<pre><code>vector[0] = 2.0f;
</code></pre>

<p>Which should make the x value of the vector be <code>2.0</code>. I've already overloaded the [ ] operator so that it returns a float (it's essentially a getter method - ex:</p>

<pre><code>cout &lt;&lt; vector[0];
</code></pre>

<p>Would print whatever the x value of vector is.) </p>

<p>I'm confused as to how I can assign the float to the <code>x</code>, <code>y</code> or <code>z</code>. I think I need to overload an operator (perhaps the =), but I am not sure. Am I thinking about this the right way?</p>
