ArrayNum.cs 909 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Library8Interface
  7. {
  8. internal abstract class AbstrClass1
  9. {
  10. protected int[] aNums;
  11. public AbstrClass1(int n)
  12. {
  13. Random random = new Random();
  14. aNums = new int[n];
  15. for (int i = 0; i < aNums.Length; i++)
  16. {
  17. aNums[i] = random.Next(100);
  18. }
  19. }
  20. public abstract void arrayОutput();
  21. }
  22. internal class ArrayNum : AbstrClass1
  23. {
  24. public ArrayNum(int n) : base(n) { }
  25. public override void arrayОutput()
  26. {
  27. Console.Write("Содержимое массива: ");
  28. foreach (int aNum in aNums)
  29. {
  30. Console.Write(aNum + " ");
  31. }
  32. Console.WriteLine();
  33. }
  34. }
  35. }