Maha

Maha

  • NA
  • 0
  • 326.2k

Inconsistent accessibility

Aug 18 2013 11:08 AM
In the following program, if both are "public" error signal is saying that Inconsistent accessibility.

Program is to executive correctly, if both accessibilities left unmentioned or one of the accessibility was mentioned "public". Problem is highlighted

Please explain the reason for differences.

using System;
public class Program
{
public static void Main()
{
IceCreamCone vanilla2 = new IceCreamCone("Vanilla", 2);
IceCreamCone chocolate1 = new IceCreamCone("Chocolate", 1);

FlavorScoop(vanilla2);
FlavorScoop(chocolate1);

Console.ReadKey();
}
public static void FlavorScoop(IceCreamCone icc)
{
Console.WriteLine(icc.GetFlavor() + " flavor" + ", " + icc.GetScoops() + " scoop");
}
}
class IceCreamCone
{
string flavor;
int scoop;

public IceCreamCone(string flavor, int scoop)
{
this.flavor = flavor;
this.scoop = scoop;
}
public string GetFlavor()
{
return flavor;
}
public int GetScoops()
{
return scoop;
}
}


Answers (18)