Устранить ошибку: "имена членов не могут совпадать с типами, в которые они входят" - C#

Узнай цену своей работы

Формулировка задачи:

Помогите устранить ошибку: "Program": имена членов не могут совпадать с типами, в которые они входят.
Листинг программы
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace lab
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. { }
  12. class Vehicle
  13. {
  14. public string Model;
  15. public string CountryOfProduce;
  16. public Vehicle(string model, string countryofproduce)
  17. {
  18. Model = model;
  19. CountryOfProduce = countryofproduce;
  20. }
  21. public void VehicleInfo()
  22. {
  23. Console.WriteLine("Model: {0}, CountryOfProduce: {1}", Model, CountryOfProduce);
  24. }
  25. }
  26. class Van : Vehicle
  27. {
  28. public string Owner;
  29. public Van(string owner, string model, string countryofproduce)
  30. : base(model, countryofproduce)
  31. {
  32. Owner = owner;
  33. }
  34. public void GetVanInfoOwner()
  35. {
  36. Console.WriteLine("Owner: {0}", Owner);
  37. }
  38. }
  39. class Program
  40. {
  41. static void Main(string[] args)
  42. {
  43. Van auto = new Van("Test LtD", "Fiat", "Italy");
  44. auto.GetVanInfoOwner();
  45. auto.VehicleInfo();
  46. Console.ReadLine();
  47. }
  48. }
  49. }
  50. }

Решение задачи: «Устранить ошибку: "имена членов не могут совпадать с типами, в которые они входят"»

textual
Листинг программы
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace lab
  8. {
  9.         class Vehicle
  10.         {
  11.             public string Model;
  12.  
  13.             public string CountryOfProduce;
  14.  
  15.             public Vehicle(string model, string countryofproduce)
  16.             {
  17.                 Model = model;
  18.  
  19.                 CountryOfProduce = countryofproduce;
  20.             }
  21.             public void VehicleInfo()
  22.             {
  23.                 Console.WriteLine("Model: {0}, CountryOfProduce: {1}", Model, CountryOfProduce);
  24.             }
  25.         }
  26.         class Van : Vehicle
  27.         {
  28.             public string Owner;
  29.  
  30.             public Van(string owner, string model, string countryofproduce)
  31.                 : base(model, countryofproduce)
  32.             {
  33.                 Owner = owner;
  34.             }
  35.             public void GetVanInfoOwner()
  36.             {
  37.                 Console.WriteLine("Owner: {0}", Owner);
  38.             }
  39.  
  40.         }
  41.  
  42.         class Program
  43.         {
  44.             static void Main(string[] args)
  45.             {
  46.                 Van auto = new Van("Test LtD", "Fiat", "Italy");
  47.                 auto.GetVanInfoOwner();
  48.                 auto.VehicleInfo();
  49.                 Console.ReadLine();
  50.  
  51.             }
  52.         }
  53. }

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

5   голосов , оценка 3.8 из 5

Нужна аналогичная работа?

Оформи быстрый заказ и узнай стоимость

Бесплатно
Оформите заказ и авторы начнут откликаться уже через 10 минут
Похожие ответы