Created
September 27, 2018 18:31
-
-
Save Vchekryzhov/27d6f413f9222873c43966292261ac3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace KozakLaba2Ind | |
{ | |
class Program | |
{ | |
public interface IFunc { | |
double CalcFunc(int x); | |
int CalcAB(IFunc func); | |
} | |
abstract public class FuncBase : IFunc{ | |
public int CalcAB(IFunc func) | |
{ | |
return 4; | |
} | |
abstract public double CalcFunc(int x);// { return 0; } | |
} | |
public class Func1 : FuncBase | |
{ | |
override public double CalcFunc(int x){ | |
return 2 * Math.Sin((x/2)+3); | |
} | |
} | |
public class Func2 : FuncBase | |
{ | |
override public double CalcFunc(int x){ | |
return 1.5*x*x - 2.5*x -4; | |
} | |
} | |
public static void Main(string[] args) | |
{ | |
Func1 f1 = new Func1(); | |
Func2 f2 = new Func2(); | |
Console.WriteLine(f1.CalcFunc(5)); | |
Console.WriteLine(f2.CalcFunc(10)); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment