title: initialize array in constructor for c++
body: <p>I don't know how to initialize array through constructor. I know that one way to initialize array to all 0 values is the one from here
  <a href="https://stackoverflow.com/questions/2890598/how-to-initialize-all-elements-in-an-array-to-the-same-number-in-c">How to initialize all elements in an array to the same number in C++</a>
  However, I DO need to follow the convention you see in my code. I need <strong>setArr()</strong> and <strong>getArr()</strong> aswell as constructor. 
  Can you please tell me, what to put for constructor and those functions, so that <strong>arr[5]</strong> will work correctly, just as <strong>i</strong> works? 
  I will really appreciate your explanation, as I did not find example of such initialization in constructor for array.
  Thank you, 
  regards</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;algorithm&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  class A
  {
  private:
      double arr[5];
      int i;
  public:
      //THIS HERE IS WRONG, BUT HOW TO PROGRAMM IT SO THAT I GET NO ERRORS?
      A( double arrx = {0}, int ix = 4):, i(ix) 
      {
          std::vector&lt;double&gt; v1(arrx, arrx+5);
          std::fill(v1.begin(arr), v1.end(arr), arrx);
      }
      ~A() {}
      void setI( int ix ) { i = ix; }
      double getI(void) { return i; }
      void setArr( double arrx[] ) 
      {
          for (int i=0; i &lt; sizeof(arrx); i++)
              arr[i] = arrx[i];
      }
      double* getArr(void) {  return arr; }
  };
  
  int main()
  {
      A ob1(6);
      //ob1.setI(5);
      std::cout &lt;&lt; ob1.getI() &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>EDIT:
  I will update the code up to when it works so that the others can benefit from it later on.
  I corrected and get error C2661: 'std::vector&lt;_Ty>::begin' : no overloaded function takes 1 arguments</p>