Access Modifiers
Access modifiers, also known as access specifiers, define the scope of accessibility for objects and their members within a class. They provide a mechanism to control the visibility and accessibility of class members. There are five distinct levels of accessibility that can be specified using access modifiers:
public, private , protected , internal and protected internal
public: Access level is not restricted.
protected: Access level is limited to the containing class or types derived from the containing class.
Internal: Access level is limited to the current assembly.
protected internal: Access level is limited to the current assembly or types derived from the containing class.
private: Access level is limited to the containing type.
If no modifier is specified, the method is given private access.
You can see here more details about... Access Specifiers
- What is object-oriented programming?
- What is a Class?
- What is an Object?
- Constructors and Destructors
- What Is Inheritance ?
- What are the different types of inheritance ?
- Why Classes cannot be declared as Protected?
- Can we declare private class in namespace
- Difference between Classes and Structures
- Can we use pointers in C# ?
- Why abstract class can't create instance
- Can you prevent your class from being inherited
- Difference between method Overloading and Overriding
- Difference between Early Binding and Late binding
- What is nested class
- What is partial class ?
- What is Virtual Method
- Difference between class and object
- What is Data Encapsulation?
- Object Based Language and OOPs
- SOLID Principles in C#
- Solid Principles | Advantages and Disadvantages