Hi all![]()
check out the class I am using static function in it.
C# Code:
class sample { int i; static int count = 0; sample() { i = 0; count++; } static void ShowCount() { Console.WriteLine(count); } }
But When I am calling the object of the class I am getting error at the underline part..C# Code:
class Program { static void Main(string[] args) { sample s1=new sample();//First Error sample.ShowCount(); //Second Error } }
The error saying that
1)'sample.sample()' is inaccessible due to its protection level
2)'sample.ShowCount()' is inaccessible due to its protection level
So what is the problem , what I am doing wrong here.
Thanks




Reply With Quote