Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Zad4A
- {
- public delegate int F(int x);
- class Funkcje
- {
- public event F fcja;
- static String msg = "";
- public static int jeden(int x)
- {
- msg += $"jeden({x}) = (x+1) ";
- return x + 1;
- }
- public static int dwa(int x)
- {
- msg += $"dwa({x}) - (2 + x) ";
- return 2 + x;
- }
- static void Main()
- {
- Funkcje ff = new Funkcje();
- ff.fcja += x => x;
- Console.WriteLine($"{ff.fcja(7)}");
- ff.fcja += jeden;
- Console.WriteLine($"{ff.fcja(5)}");
- ff.fcja += dwa;
- Console.WriteLine($"{ff.fcja(3)}");
- ff.fcja -= jeden;
- Console.WriteLine($"{ff.fcja(1)}");
- Console.WriteLine(msg);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement