title: C++ function, what default value can I give for an object?
body: <p>I'm new in C++ programming, so please don't be too harsh now :) . A minimal description of my problem is illustrated by the following example. Say I have this function declaration in a header file:</p>
  
  <pre><code>int f(int x=0, MyClass a); // gives compiler error
  </code></pre>
  
  <p>The compiler complains because parameters following a parameter with default value should have default values too. </p>
  
  <p>But what default value can I give the second parameter?</p>
  
  <p>The idea is that the function could be called with with less than two args if the rest isn't relevant for a particular case, so all the following should go:</p>
  
  <pre><code>MyClass myObj; // create myObj as an instance of the class MyClass
  int result=f(3,myObj); // explicit values for both args
  </code></pre>
  
  <p><code>int result=f(3); // explicit for first, default for second arg</code> </p>
  
  <p><code>int result=f(); // defaults for both</code></p>