c# - Understanding default access modifiers -


i confused access modifiers, thought ask couple of quick questions clarification:

is case in absence of access modifiers data members of class, default private, though class internal?

class {     int x; } 

so, int x private int x , class a internal class a?

=========================================

also, why following code not compile?

class {     protected int x; }  public class b : {} 

as documentation states, classes , structs default internal , members private.

the code won't compile because, error message state, cannot inherit less accessible class. in case child class public , parent internal.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -