Where we are using all access specifiers in real time
where we use access specifiers in real time c # application and why we are using these access specifiers only...plz provide some real time example also.....
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mangesh GRank #294 · 8.6K reputationPosted Dec 20, 2016, 10:00 PM EST
1.Public
it is accessbile to all means there is No restriction to use it u can use it anywhere at anytime
2.Private
it is limited to class only class level an cannot be accessed outside the class
3.Protected
Scope is Limited to the class an its inherited members
4.internal
Scope is Limited to the namespace level an it cannot be accessed outside the assembly
So summing up the things considering the House
1.House has a Hall == It Becomes Public
2.House has a Bedroom == It Becomes Protected in case the relative can have access to the bedroom
3.House has a Locker== It Becomes Private as no one likes to reveal the things here not even the relatives too
MayankRank #4,018 · 371 reputationPosted Dec 21, 2016, 11:57 PM EST
protected string protectedVariable;
//Available to the container class, entire assembly and to outside
public string publicVariable;
protected internal string protectedInternalVariable;