Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. interface IHuman
  2.     {
  3.         void chlen(); // контракт
  4.     }
  5.  
  6.     class Bodyan: IHuman
  7.     {
  8.         public void chlen() // реализация контракта обязательна
  9.         {
  10.             Console.WriteLine("U menya chlen 11 cm!!!");
  11.         }
  12.     }
  13.     class Telka: IHuman
  14.     {
  15.         public void chlen()// реализация контракта обязательна
  16.         {
  17.             Console.WriteLine("U menya net chlena :ccc");
  18.         }
  19.     }
  20.  
  21.     class Program
  22.     {
  23.         static void Main(string[] args)
  24.         {
  25.             IHuman humanus = new Telka(); // контейнер, может принимать конструктор new Bodyan()
  26.             humanus.chlen();
  27.             Console.ReadKey();
  28.         }
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement