Recall & Review
beginner
What does the public access modifier mean in C#?
The <strong>public</strong> modifier means the member or class is accessible from anywhere in the program or other programs that reference it. It's like a door open to everyone.Click to reveal answer
beginner
What is the purpose of the private access modifier?
The <strong>private</strong> modifier restricts access to the member or class so it can only be used inside the same class. Think of it as a secret only the class knows.Click to reveal answer
intermediate
Explain the internal access modifier in C#.
The internal modifier allows access only within the same assembly (project). It's like a private room shared only with people in the same building.
Click to reveal answer
beginner
Which access modifier is the default for class members if none is specified?If no access modifier is specified for class members, the default is <strong>private</strong>. So, members are hidden unless you say otherwise.Click to reveal answer
beginner
Can a <strong>private</strong> member be accessed from another class in the same assembly?No, <strong>private</strong> members are only accessible inside their own class, even if another class is in the same assembly.Click to reveal answer
Which access modifier allows a class member to be accessed from any other code in the same assembly or another assembly?
✗ Incorrect
The public modifier allows access from anywhere, including other assemblies.
What is the default access level for members of a class if no modifier is specified?
✗ Incorrect
Class members are private by default if no access modifier is given.
Which access modifier restricts access to the same assembly only?
✗ Incorrect
internal limits access to the same assembly.
Can a private member be accessed from a derived class?
✗ Incorrect
private members are not accessible outside their own class, even in derived classes.
Which modifier would you use to allow access only within the same class and derived classes?
✗ Incorrect
protected allows access within the class and its subclasses.
Describe the differences between public, private, and internal access modifiers in C#.
Think about who can open the door to the member or class.
You got /3 concepts.
Explain why you might choose to use private instead of public for a class member.
Consider keeping secrets safe inside a class.
You got /3 concepts.