title: C++ constructor with one default parameter and one variable parameter
body: <p>I'm writing this class constructor:</p>
  
  <pre><code>element(int f=0, int a)
  {
      first = f;
      inc = a;
      current = first - inc;
  }
  </code></pre>
  
  <p>The parameters are assigned to member variables in the body of the constructor. I've been asked to get the following calls in <code>main()</code> to work:</p>
  
  <pre><code>prog = new element(3,5);
  prog = new element(5);
  </code></pre>
  
  <p>I cannot change the order of <code>(3,5)</code>. As in within the constructor, <code>f</code> needs to be passed first, and <code>a</code> second. However, <code>f</code> needs to be initialized to 0 if no value is passed in, that way the second call keeps <code>f</code> at 0 and instead only initializes <code>a</code> to 5.</p>
  
  <p>The issue with this is that I get an error if I place the parameters in this order within the constructor signature.</p>
  
  <p>How do I solve this?</p>