Error: inaccessible due to its protection level

Posted by Manikandan711 under C# on 3/6/2013 | Points: 10 | Views : 3285 | Status : [Member] | Replies : 1
I know this is a basic question but i need some depth details
Why i could not able create objects for the non static class in the static method?

Fo ex:
In this following code and getting "inaccessible due to its protection level" error ...
Please explain..

namespace dotnetfunda_ex1
public class ClassA
ClassA(int var)
{ }

public static void tm()
{ }


class Program

public static void Main(string[] args)
ClassA obj = new ClassA(1);



Manikandan Muthuraj

Thanks & Regards,
Manikandan Muthuraj


Posted by: Oswaldlily on: 3/8/2013 [Member] Starter | Points: 25

Static classes are sealed and so v can't create Object....

According to Your question "for the non static class in the static method? "
Non static class :both Program ,ClassA (You can create objects for these both)

Can You check your question?

Manikandan711, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response