From the course: C# Essential Training 1: Types and Control Flow

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Applying access modifiers

Applying access modifiers

- [Instructor] Remember that when I tried to use that constants from my LinkedIn essentials, I don't have any properties there. If I look at the error from the compiler, it says it's inaccessible due to its protection level. In addition to the namespace being in scope, the reference being there, I also have to make sure that the accessibility that I've defined opens up my type to all the users I want or locks it down to those that I don't. We were able to use employee and manager, so you can see there's a difference here. I have a static class constants. We open our other classes. Notice these, including the interface, all have public as the access modifier at the beginning, meaning that they're accessible within this library, to derived classes, and even outside this library. Public essentially opens it up to anything that has a reference and has the namespace and scope. Constants, on the other hand, has no access modifier,…

Contents