Hi everyone.....
class Program
{
private int price = 0;
static void Main(string[] args)
{
Program instance = new Program();
Console.WriteLine("ENTER PRICE");
instance.price = Convert.ToInt32(Console.ReadLine());
}
Ok so im learning...as you may have guessed...
My question is..I know we should use getters and setters so we can shield the public from having any access to fields such as "price".
But here I am assigning price the value straight from the command prompt that is entered...
Why does it allow me to do this if I have declared "price" private?
thanks for your help...