namespace Rational
{
class Program
static void Main(string[] args)
}
public class Rational
//член данни
private int numer;
private int denom;
//свойства
public int Numer
set
this.numer = value;
get
return this.numer;
public int Denom
if(value == 0) this.denom = 1;
else this.denom = value;
return this.denom;
//конструктор
//методи
public Rational Add(Rational r)
Rational result = new Rational();
result.numer = this.numer*r.denom+this.denom*r.numer;
result.denom = this.denom*r.denom;
return result;