A
Abilay_Satibaldiev
Guest
using System;
class Pair
{
public int a, b;
public Pair(int a, int b)
{
this.a = a;
this.b = b;
}
public virtual Pair alu(Pair A)
{
return new Pair(a - A.a, b - A.b);
}
public virtual Pair kosu(Pair A)
{
return new Pair(a + A.a, b + A.b);
}
public virtual void info()
{
Console.WriteLine("a=" + a + ",b=" + b);
}
}
class Racional_san : Pair
{
public Racional_san(int a, int b) : base(a, b) { }
public override Racional_san alu(Racional_san A)
{
return new Racional_san(a * A.b - b * A.a, b * A.b);
}
public override Racional_san kosu(Racional_san A)
{
return new Racional_san(a * A.b + b * A.a, b * A.b);
}
public override void info()
{
base.info();
}
}
class Program
{
static void Main(string[] args)
{
Pair A = new Pair(2, 4);
Pair B = new Pair(1, 2);
Pair C = A.alu(B);
Pair D = A.kosu(B);
Console.Write("ob1: ");
A.info();
Console.Write("ob2: ");
B.info();
Console.WriteLine("azaityndysy(ob1-ob2): " + C.a + "," + C.b);
Console.WriteLine("kosyndysy(ob1+ob2): " + D.a + "," + D.b);
Racional_san E = new Racional_san(2, 4);
Racional_san F = new Racional_san(1, 2);
Console.Write("ob3(racional): ");
D.info();
Console.Write("ob4(racional): ");
E.info();
Console.WriteLine("azaityndysy(ob3-ob4): " + F.a + "," + F.b);
Racional_san G = E.alu(F);
Racional_san H = E.kosu(F);
Console.WriteLine("kosyndysy(ob3+ob4): " + H.a + "," + H.b);
Console.ReadKey();
}
}
//Error 1 'Racional_san.alu(Racional_san)': no suitable method found to override
//Error 2 'Racional_san.kosu(Racional_san)': no suitable method found to override
Continue reading...
class Pair
{
public int a, b;
public Pair(int a, int b)
{
this.a = a;
this.b = b;
}
public virtual Pair alu(Pair A)
{
return new Pair(a - A.a, b - A.b);
}
public virtual Pair kosu(Pair A)
{
return new Pair(a + A.a, b + A.b);
}
public virtual void info()
{
Console.WriteLine("a=" + a + ",b=" + b);
}
}
class Racional_san : Pair
{
public Racional_san(int a, int b) : base(a, b) { }
public override Racional_san alu(Racional_san A)
{
return new Racional_san(a * A.b - b * A.a, b * A.b);
}
public override Racional_san kosu(Racional_san A)
{
return new Racional_san(a * A.b + b * A.a, b * A.b);
}
public override void info()
{
base.info();
}
}
class Program
{
static void Main(string[] args)
{
Pair A = new Pair(2, 4);
Pair B = new Pair(1, 2);
Pair C = A.alu(B);
Pair D = A.kosu(B);
Console.Write("ob1: ");
A.info();
Console.Write("ob2: ");
B.info();
Console.WriteLine("azaityndysy(ob1-ob2): " + C.a + "," + C.b);
Console.WriteLine("kosyndysy(ob1+ob2): " + D.a + "," + D.b);
Racional_san E = new Racional_san(2, 4);
Racional_san F = new Racional_san(1, 2);
Console.Write("ob3(racional): ");
D.info();
Console.Write("ob4(racional): ");
E.info();
Console.WriteLine("azaityndysy(ob3-ob4): " + F.a + "," + F.b);
Racional_san G = E.alu(F);
Racional_san H = E.kosu(F);
Console.WriteLine("kosyndysy(ob3+ob4): " + H.a + "," + H.b);
Console.ReadKey();
}
}
//Error 1 'Racional_san.alu(Racional_san)': no suitable method found to override
//Error 2 'Racional_san.kosu(Racional_san)': no suitable method found to override
Continue reading...