NadyaMisheva

static pole

Apr 13th, 2019
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. Car car1 = new Car();
  8. Car car2 = new Car();
  9. Car car3 = new Car();
  10. Car car4 = new Car();
  11. Car.brand = "BMW";
  12. Console.WriteLine(Car.brand);
  13. Car.SetBrand();
  14. Console.WriteLine(Car.brand);
  15. }
  16. }
  17.  
  18. class Car
  19. {
  20.  
  21. public static string brand;
  22. string model;
  23. double price;
  24.  
  25. public Car(string model, double price)
  26. {
  27. this.model = model;
  28. this.price = price;
  29. }
  30. public Car()
  31. {
  32. this.model = "astra";
  33. this.price = 17000;
  34. }
  35. public static void SetBrand()
  36. {
  37. brand = "Lada";
  38. }
  39. }
Add Comment
Please, Sign In to add comment