Устранить ошибку: "имена членов не могут совпадать с типами, в которые они входят" - C#
Формулировка задачи:
Помогите устранить ошибку:
"Program": имена членов не могут совпадать с типами, в которые они входят.
Листинг программы
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace lab
- {
- class Program
- {
- static void Main(string[] args)
- { }
- class Vehicle
- {
- public string Model;
- public string CountryOfProduce;
- public Vehicle(string model, string countryofproduce)
- {
- Model = model;
- CountryOfProduce = countryofproduce;
- }
- public void VehicleInfo()
- {
- Console.WriteLine("Model: {0}, CountryOfProduce: {1}", Model, CountryOfProduce);
- }
- }
- class Van : Vehicle
- {
- public string Owner;
- public Van(string owner, string model, string countryofproduce)
- : base(model, countryofproduce)
- {
- Owner = owner;
- }
- public void GetVanInfoOwner()
- {
- Console.WriteLine("Owner: {0}", Owner);
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Van auto = new Van("Test LtD", "Fiat", "Italy");
- auto.GetVanInfoOwner();
- auto.VehicleInfo();
- Console.ReadLine();
- }
- }
- }
- }
Решение задачи: «Устранить ошибку: "имена членов не могут совпадать с типами, в которые они входят"»
textual
Листинг программы
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace lab
- {
- class Vehicle
- {
- public string Model;
- public string CountryOfProduce;
- public Vehicle(string model, string countryofproduce)
- {
- Model = model;
- CountryOfProduce = countryofproduce;
- }
- public void VehicleInfo()
- {
- Console.WriteLine("Model: {0}, CountryOfProduce: {1}", Model, CountryOfProduce);
- }
- }
- class Van : Vehicle
- {
- public string Owner;
- public Van(string owner, string model, string countryofproduce)
- : base(model, countryofproduce)
- {
- Owner = owner;
- }
- public void GetVanInfoOwner()
- {
- Console.WriteLine("Owner: {0}", Owner);
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Van auto = new Van("Test LtD", "Fiat", "Italy");
- auto.GetVanInfoOwner();
- auto.VehicleInfo();
- Console.ReadLine();
- }
- }
- }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д