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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
MayankPosted Dec 22, 2016, 4:57 AM
protected string protectedVariable;
//Available to the container class, entire assembly and to outside
public string publicVariable;
protected internal string protectedInternalVariable;
Mangesh GPosted Dec 21, 2016, 3:00 AM
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