http://www.c-sharpcorner.com/Forums/Thread/225889/inconsistent-accessibility.aspxI wish to know whether it is possible to demonstrate behavioural pattern mentioned of FlavorScoop() method by an example.
Your explanation about using access modifier (14th thread of Inconsistent accessibility)After this (single module) assembly has been compiled, it could (in theory) be added as a reference to another assembly. If code in the latter assembly wanted to call the FlavorScoop method, it would have problems in doing so because it wouldn't have access to the IceCreamCone class.The compiler is therefore ensuring that these problems won't arise by flagging it as an error now.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;
}
}