title: How can I create an array of class objects whose constructor require few arguments?
body: <p>I've read about solution <code>const A a[3] = { {0,0}, {1,1}, {2,2} },</code> but in my program <code>const</code> can't be used:</p>
  
  <pre><code>class Paper: public PaperQueue{  
    ...
    protected:
      typedef int (Utils::*funcPtr) (int, int); //I use external function there
      funcPtr p;                               
      Utils* fptr; 
    public:
      int pricefunc(){     
        addprice = (fptr-&gt;*p) (t,price);
      }
  
      Paper(int n, unsigned int pr):PaperQueue(n){         
         ...
         p=&amp;Utils::commonpricefunc;    
      }
      void Put(int a){ 
         ...
      }
    ...
  }    
  
  class Bank{ 
    ...
    void Buy(Paper &amp;p){
     (/*this function modifies many parameters in 'p'*/)
    ...
    }
    ...
  }
  
  int main(){
  Bank B;    
  int pn=5;
  /* ? */ const Paper p[pn] = {{5,15},{5,15},{5,15},{5,15},{5,15}}; /* ? */
  int paperloop=0;
  ...
  p[paperloop].Put(p[paperloop].addprice);
  B.Buy(p[paperloop]);
  ...
  </code></pre>
  
  <p>That gives me a LOT of errors(with pricefunc(),Put(),Buy(),...), or just "variable-sized object ‘p’ may not be initialized". Is there any way to make this array work? (Everything works fine if not to pass any parameters to constructor!)</p>