What is difference between private, protected, and public in C#?



What is difference between private, protected, and public in C#?..

Answer / Ravindra Kumar Tiwari

In C#, Access Modifiers are used to control access to a class member (field, property, method, or event) from other classes. The three access modifiers are Private, Protected, and Public.nnPrivate members can only be accessed within the same class.nProtected members can be accessed within the same class and derived classes.nPublic members can be accessed from any class.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Sharp Interview Questions

What does the term immutable mean?

3 Answers   Satyam, Siebel Systems, Techno Labs,


What is a static class in c#?

1 Answers  


What is default constructor c#?

1 Answers  


What is an enumerator c#?

1 Answers  


What is equal c#?

1 Answers  


What is difference between int and int in c#?

1 Answers  


Explain the advantage of using system.text.stringbuilder over system.string?

1 Answers  


Is string passed by reference in c#?

1 Answers  


How do you implement multiple inheritance in .NET?

10 Answers   Microsoft,


What is Reflection in .NET? Namespace? How will you load an assembly which is not referenced by current assembly?

1 Answers  


Explain constructor?

6 Answers   Wipro,


Can destructors have access modifiers?

1 Answers  


Categories