// File: ex6-3.cpp - overloaded + and ! operator for the Fraction class

#include <iostream>
using namespace std;

class Fraction
{
  private:
	 int numer;
	 int denom;
  public:
	 Fraction(int n = 0, int d = 1);
	 void operator!() const;
	 Fraction operator+(const Fraction&);  // What's wrong with this?
};

Fraction::Fraction(int n, int d) : numer(n), denom(d)
{ }

// print a Fraction
void Fraction::operator!() const
{
cout << numer << '/' << denom << endl;
}

Fraction Fraction::operator+(const Fraction& f2)
{
Fraction temp(0,0);
temp.numer = numer * f2.denom + f2.numer * denom;
temp.denom = denom * f2.denom;
return temp;
}

int main()
{
Fraction f(3,4); // initialize Fraction f & g Fraction g(2,3); Fraction h = f + g; !h; }