Rohan  Rathore
What is difference between private, protected, and public in C#?
By Rohan Rathore in C# on Jun 07 2013
  • mayur joshi
    Jun, 2015 28

    publicThe type or member can be accessed by any other code in the same assembly or another assembly that references it.privateThe type or member can only be accessed by code in the same class or struct.protectedThe type or member can only be accessed by code in the same class or struct, or in a derived class.internalThe type or member can be accessed by any code in the same assembly, but not from another assembly.protected internalThe type or member can be accessed by any code in the same assembly, or by any derived class in another assembly.

    • 1
  • Rajavel G
    Nov, 2016 26

    Private: Access is limited to the containing class Public : Access is not restricted Protected : Access is limiting to the class or type derived from the containing class.Protected variables can accessed using inheritance.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS