Quipex

лаба4 макс

May 18th, 2016
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace Prov
  4. {
  5.     public class A
  6.     {
  7.         public int a = 5, b = 5, i = 0;
  8.         public int c
  9.         {
  10.             get
  11.             {
  12.                 a += a;
  13.                 --b;
  14.                 i++;
  15.                 return
  16.                     i * (a - b);
  17.             }
  18.             set
  19.             {
  20.                 c = value;
  21.             }
  22.         }
  23.     }
  24.     class programm
  25.     {
  26.         public static void Main()
  27.         {
  28.             B myB = new B();
  29.             for (int i = 0; i < myB.k; i++)
  30.             {
  31.                 Console.WriteLine(myB[i]);
  32.             }
  33.             Console.WriteLine(C.St.x);
  34.             Console.ReadLine();
  35.         }
  36.     }
  37.     public class B : A
  38.     {
  39.         public int[] mass;
  40.         public int k;
  41.         public B() : base()
  42.         {
  43.             mass = new int[a];
  44.             k = a;
  45.         }
  46.         public int this[int i]
  47.         {
  48.             get
  49.             {
  50.                 return c;
  51.             }
  52.             set
  53.             {
  54.                 mass[i] = value;
  55.             }
  56.         }        
  57.     }
  58.     public class C
  59.     {
  60.         public struct St
  61.         {
  62.             public static int x = 20;
  63.         }
  64.  
  65.     }
  66. }
Add Comment
Please, Sign In to add comment