- What are the four access modifiers and what do they do?
Answer: The four access modifiers and their effect are described here:
-
- private: This modifier makes a member only visible inside the class
- internal: This modifier makes a member only visible inside the class or within the same assembly
- protected: This modifier makes a member only visible inside the class or derived classes
- public: This modifier makes a member visible everywhere
- What is the difference between the static, const, and readonly keywords?
Answer: The difference between the static, const, and readonly keywords is:
-
- static: This keyword makes the member shared by all instances and accessed through the type
- const: This keyword makes a field a fixed literal value that should never change
- readonly: This keyword makes a field that...