What are the different access modifier? Explain in detail?
Answers were Sorted based on User's Feedback
Answer / imatoria
The access modifier on a property applies to both its get
and set accessors, so different modifiers can’t be applied
for same property.
1. Public- Accessible outside the class through object.
2. Private- Accessible inside the class by member
functions.
3. Protected- Just like private but accessible in derived
class also but by member functions.
4. Internal- Visible inside the Assembly. Accessible through
members. Logic is same as global private.
5. Protected Internal- Visible inside the assembly and
outside the assembly through derived classes.
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / pushparaj pentakota(anakapalli
public == accessble from any where,no restriction.
private == aceessble only from within the class only.
protected == accessble from same class and child class also
but not from non-child class.it may be within
project or out side of the project also.
internal == accessble only from same class and child class
and non-child class also but within the project
only.
protected internal == accessble from any where except
non-child class of out side of the
project.
| Is This Answer Correct ? | 0 Yes | 0 No |
How can i create only one instance of class and thus doesn't allow creating any more instances?
What happens to the winfx technologies?
Xmlserializer is throwing a generic "there was an error reflecting myclass" error. How do I find out what the problem is?
What is the difference between .net mobile pages and ordinary .net web page? : Microsoft dot net mobile
Explain how does .net mobile work? : Microsoft dot net mobile
what does dot in .net means
what are constructors and destructors?
What size is a .net object?
how do u achieve multilevel inheritance in .NET ?
9 Answers Accenture, Ness Technologies, SteelWedge,
What do you know about machine.config file ?
What other than biginteger has been introduced in system.numerics namespace?
What is the use of TPL DATAFLOW?