fork download
  1. using System;
  2. class Class_1x {
  3. public int x = 0, y = 0;
  4. }
  5.  
  6. class Class_2x : Class_1x {
  7. new int x, y;
  8. public Class_2x(int x, int y)
  9. {
  10. x = this.x;
  11. y = this.y;
  12. base.x = this.x;
  13. base.y = this.y;
  14. }
  15.  
  16. public void Show(bool a, bool b)
  17. {
  18. if(a == true)
  19. {
  20. Console.Write("base.x равно " + base.x);
  21. }
  22. else Console.Write("x равно " + x);
  23.  
  24. if (b == true)
  25. {
  26. Console.Write("base.y равно " + base.y);
  27. }
  28. else Console.Write("y равно " + y);
  29. }
  30. }
  31. class Program {
  32. static void Main()
  33. {
  34. Class_2x ob = new Class_2x(5, 10);
  35. //Сюды нужно экзыпляр класса!
  36. ob.Show(true, true);
  37. ob.Show(true, false);
  38. ob.Show(false, true);
  39. ob.Show(false, false);
  40. }
  41. }
Success #stdin #stdout 0.01s 14760KB
stdin
Standard input is empty
stdout
base.x равно 0base.y равно 0base.x равно 0y равно 0x равно 0base.y равно 0x равно 0y равно 0