Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5.  
  6. public class Bod2D
  7. {
  8.  
  9. public int x { get; set; }
  10. public int y { get; set; }
  11.  
  12. public override string ToString()
  13. {
  14. return $"x={x} y={y}";
  15. }
  16. public Bod2D(int x, int y)
  17. {
  18.  
  19. this.x = x;
  20. this.y = y;
  21. }
  22. }
  23.  
  24.  
  25. public class Kruh
  26. {
  27.  
  28. public Bod2D bod { get; set; }
  29. public int r { get; set; }
  30.  
  31. public Kruh(Bod2D bod, int r)
  32. {
  33. this.bod = bod;
  34. this.r = r;
  35.  
  36. }
  37.  
  38. public double V { get; set; }
  39. public void VratObvod()
  40. {
  41. double V = 2 * Math.PI * r;
  42. bod.x = 5;
  43.  
  44. }
  45. }
  46.  
  47. class Program
  48. {
  49. static void Main(string[] args)
  50. {
  51. Bod2D bod = new Bod2D(2, 3);
  52. Kruh kruh = new Kruh(bod, 10);
  53. //Console.WriteLine(kruh.bod.x + " " +kruh.bod.y);
  54.  
  55. kruh.VratObvod();
  56. Console.WriteLine(kruh.V);
  57. Console.ReadKey();
  58.  
  59. }
  60. }
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement