Click here to Skip to main content
15,898,036 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Why can't we use protected and protected internal specifiers prefixing class name
Posted
Comments
Karthik_Mahalingam 4-Jan-14 14:36pm    
you can use it , that depends on the requirement....

1 solution

Root level classes, that is classes directly under a namespace, can either be internal or public. By default if you don't specify an access modifier, they are internal.

Classes defined inside other classes (nested classes) may be declared protected.

Why can't you use protected? Well protected means that the object is accessible to members of its declaring type, since root classes don't have a declaring type, they can't be protected from anything. "protected internal" doesn't make any sense after you get the concept I just described.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900