title: Ambiguous call of overloaded class method
body: <p>I am implementing a class for rational numbers. I've created a constructor with parameters and all of my methods. I tried to add a default constructor as well, in the case that no parameters were provided.</p>
  <p>These are the relevant sections of the code:</p>
  <pre><code>Rational::Rational(int numer, int denom){ //Constructor
      numer = numer;
      denom = denom;
  }
  Rational::Rational(){
    int numer = 1;
    int denom = 2;
  }
  </code></pre>
  <pre><code>#ifndef RATIONAL_H
  #define RATIONAL_H
  
  class Rational{
  private:
      int numer;
      int denom;
  
  public:
      Rational(int numer=1, int denom=2); // Tried to use this to provide defaults, but still generated errors unless I provided parameters in the Test Driver.
      Rational(); // Tried to make a separate default constructor, also causing errors
      int getNumer();
      int getDenom();
      Rational add(Rational b);
      Rational sub(Rational b); 
      Rational mult(Rational b); 
      Rational divide(Rational b); 
      void setValues(int numer, int denom);
      void print();
      void printFloat();
  };
  
  
  #endif
  
  </code></pre>
  <pre><code>int main(){
      Rational r(3,4); // Succesfully creates a fraction 3/4
      Rational r1; //causes error
  </code></pre>
  <p>This is the error that trying to create the second, default, constructor generated, and I'm not quite sure what the problem is:</p>
  <blockquote>
  <p>error: call of overloaded ‘Rational()’ is ambiguous</p>
  </blockquote>