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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -