title: Class design: arrays vs multiple variables
body: <p>I have a bit of a theoretical question, however it is a problem I sometimes face when designing classes and I see it done differently when reading others code. Which of the following would be better and why:</p>
  
  <p>example 1:</p>
  
  <pre><code>class Color
  {
  public:
    Color(float, float, float);
    ~Color();
  
    friend bool operator==(Color&amp; lhs, Color&amp; rhs);
    void multiply(Color);
    // ...
    float get_r();
    float get_g();
    float get_b();
  
  private:
    float color_values[3];
  }
  </code></pre>
  
  <p>example 2:</p>
  
  <pre><code>class Color
  {
  public:
    // as above
  
  private:
    float r;
    float g;
    float b;
  }
  </code></pre>
  
  <p>Is there a general rule one should follow in cases like this or is it just up to a programmer and what seems to make more sense?</p>