title: Classes & functions calling invoking object
body: <p>I have two questions about my program. The program i made creates 2 fraction objects and does arithmetic with them. 
  First, is it possible for a function in the class.cpp file to have multiple objects as its parameter:</p>
  
  <pre><code>int Rational::addNums(Rational f1, Rational f2)
  </code></pre>
  
  <p>Secondly, in my code, for some reason my program never reach the addNums function call when executed. It seems to stop after the getDenom() function. Im not sure why this would be happening.</p>
  
  <pre><code>class Rational
  {
  public:
      Rational(int = 2, int = 4);//default constructor thats set numerator and denominator with default values
  
      //set functions
      void setFrac(int, int);
      void setNumer(int);
      void setDenom(int);
  
      //get functions
      int getNumer() const;
      int getDenom() const;
  
      //arithmetic functions
      int addNums(Rational, Rational);
      int subNums(int, int);
      int multNums(int, int);
      int divNums(int, int);
  
  
      void DisplayFracs(int);
      void DisplayDecimals(float);
  
  
  private:
      int num;//numerator of fraction1
      int den;//denominator of fraction1
  
  };
  
  #include &lt;iostream&gt;
  #include "Rational.h"
  
  using namespace std;
  
  
  Rational::Rational(int num, int den)
  {
      setFrac(num, den);
  }
  
  void Rational::setFrac( int n, int d)
  {
      setNumer(n);
      setDenom(d);
  }
  
  void Rational::setNumer(int n)
  {
      if ( n != 0)
          num = n;
      else
          cout &lt;&lt; n &lt;&lt; " is not a valid number." &lt;&lt; endl;
  
      }
  
  void Rational::setDenom(int d)
  {
      if ( d != 0)
          den = d;
      else
          cout &lt;&lt; d &lt;&lt; " is not a valid number." &lt;&lt; endl;
  }
  
  int Rational::getNumer()const
  {
      return num;
  }
  
  int Rational::getDenom() const
  {
      return den;
  }
  
  int Rational::addNums(Rational f1, Rational f2)
  {
      int m = f1.den;
      int n = f2.den;
  
          int temp = 0;
          if(m &lt; n)
          {
              temp = m;
              m = n;
              n = temp;
          }
      cout &lt;&lt; m &lt;&lt; "  :   " &lt;&lt; n &lt;&lt; endl;
          while(n != 0)
          {
              temp = m % n;
              m = n;
              n = temp;
          }
      cout &lt;&lt; m &lt;&lt; "  :   " &lt;&lt; n &lt;&lt; endl;
          return f1.den = m;
          return f2.den = n;
  
  }
  
  int main()
  {
      Rational f1(2,7);
      Rational f2(3,8);
  
      cout &lt;&lt; f1.getDenom()&lt;&lt; "   :   " &lt;&lt; f2.getDenom() &lt;&lt; endl;
  }  
  </code></pre>
  
  <p>Thanks for the help.</p>