예제 #1
0
 /// <summary>
 /// Operator adding fraction and number
 /// </summary>
 public static Fraction operator +(Fraction fraction, int number)
 {
     var result = new Fraction(fraction);
     result.Add(number);
     return result;
 }
예제 #2
0
 /// <summary>
 /// Operator subtracting number and fraction
 /// </summary>
 public static Fraction operator -(int number, Fraction fraction)
 {
     var result = new Fraction(fraction);
     result.Numerator *= -1;
     result.Add(number);
     return result;
 }
예제 #3
0
 /// <summary>
 /// Operator adding two fractions
 /// </summary>
 public static Fraction operator +(Fraction first, Fraction second)
 {
     var result = new Fraction(first);
     result.Add(second);
     return result;
 }