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 Zad4
- {
- interface IOdleglosc<T>
- {
- int Odleglosc(T a, T b);
- }
- class Dystans : IOdleglosc<int>
- {
- public int Odleglosc(int a, int b)
- {
- return b - a;
- }
- }
- class Osoba
- {
- public string nazwisko;
- public int waga;
- public Osoba(string nazwisko, int waga)
- {
- this.nazwisko = nazwisko;
- this.waga = waga;
- }
- }
- class Roznica : IOdleglosc<Osoba>
- {
- public int Odleglosc(Osoba a, Osoba b)
- {
- return b.nazwisko.Length - a.nazwisko.Length;
- }
- }
- class Program
- {
- static List<T> Filtruj<T>(List<T> list,IOdleglosc<T> odleglosc, T t, int promien)
- {
- list.Sort(odleglosc);
- }
- static void Main(string[] args)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement