Questions involving C# Access Modifier keywords.
1. Describe how the keyword "internal" affects access.
Answer: can only be accessed from the same assembly
2. Describe how the keyword "private" affects access.
Answer: can only be accessed from same class or structure
3. Describe how the keyword "protected" affects access.
Answer: can only be accessed from the class where it is declared or a derived class
4. Describe how the keyword "public" affects access.
Answer: No Restriction
5. Can multiple access modifiers be used on a member or type.
Answer: Only the combination "protected internal" is allowed
6. What is the default accessibility of an enum?
Answer: public
7. What is the default accessibility of an interface?
Answer: public
8. What is the default accessibility of a class ?
Answer: private
9. What is the default accessibility of an struct?
Answer: private
No comments:
Post a Comment