Member variable in C++ class that is always constant for all objects of that class?
<p>I'm constructing a class where I have three member variables that I want to always be the same value NO MATTER WHAT.</p>

<p>I have</p>

<pre><code>class foo{

public:
    double var_1, var_2, var_3;
    double x=1, y=2, z=3;

[functions go here]

};
</code></pre>

<p>that gave me an error since I can't initialize a variable like that. But I want x, y and z to always be 1, 2 and 3 respectively. I tried defining them outside the class but that doesn't work since I want them to be member variables of the class.</p>

<p>How do I do this?</p>
