3
Reply

inconsistent accessibility

Ask a question
herbie

herbie

17y
2.7k
1
 am learing C# the chapter I am on discusses arrays.  I am receive the following error but am not sure what it means or how to fix it ...any help would be appericated.

 

 

Inconsistent accessibility: parameter type 'PassingCar1Array.CarArray.Car[]' is less accessible than method 'PassingCar1Array.CarArray.DisplayFleet(params PassingCar1Array.CarArray.Car[])'

 

 

using System;

namespace PassingCar1Array

{

public class CarArray

{

public static void Main()

{

Car[] car = new Car [5];

int x;

int enteredId;

string enteredMake;

string enteredModel;

string enteredColor;

double enteredValue;

for(x = 2; x < car.Length; ++x)

car[x] = new Car();

DisplayFleet(car);

}

public static void DisplayFleet (params Car[] Car)

{

Console.WriteLine("{0,10}{1,10}{2,10}{3,10}{4,10}{5,10}","id","make","model","color","value");

foreach(Car car in Cars)

{

Console.WriteLine("{0,10}{1,10}{2,10}{3,10}{4,10}{5,10}",Car.GetId(),Car.GetMake(),Car.GetModel(),Car.GetColor(),Car.GetValue());

}

}

class Car

{

private int idNumber;

private string make;

private string model;

private string color;

private double value;

public int GetId()

{

return idNumber;

}

public string GetMake()

{

return make;

}

public string GetModel()

{

return model;

}

public string GetColor()

{

return color;

}

public double GetValue()

{

return value;

}

public void SetId(int id)

{

idNumber = id;

}

public void SetMake(string carMake)

{

make = carMake;

}

public void SetModel(string carModel)

{

model = carModel;

}

public void SetColor(string carColor)

{

color = carColor;

}

public void SetValue(double carValue)

{

value = carValue;

}

}

}

}


Answers (3)
Next Recommended Forum