What are the access-specifiers available in c#?
Answer Posted / anupam dixit
1. Public: Any member declared public can be accessed from
outside the class.
2. Private: it allows a class to hide its member variables
and member functions from other class objects and function.
Therefore, the private member of a class is not visible
outside a class. if a member is declared private, only the
functions of that class access the member.
3. Protected: This also allows a class to hide its member
var. and member func. from other class objects and
function, except the child class. it becomes important
while implementing inheritance.
4. Internal: Internal member can be expose to other
function and objects. it can be accessed from any class or
method defined within the application in which the member
is defined
5. Protected Internal: it's similar to Protected access
specifier, it also allows a class to hide its member
variables and member function to be accessed from other
class objects and function, excepts child class, within the
application. used while implementing inheritance.
| Is This Answer Correct ? | 126 Yes | 23 No |
Post New Answer View All Answers
What are the different types of delegation?
Classes and structs can be declared as static, is this statement true or false?
What is strong name assembly?
How many kinds of elements an array can have?
Is nullable type c#?
So let's say I have an application that uses myapp.dll assembly, version 1.0.0.0. There is a security bug in that assembly, and I publish the patch, issuing it under name myapp.dll 1.1.0.0. How do I tell the client applications that are already installed to start using this new myapp.dll?
How do you create user defined data types in c#?
Define an escape sequence, name few strings in escape sequence?
What do you mean by expression tree?
Explain the difference between class and interface in .net?
What is state c#?
What is console readkey ()?
How big is a 64 bit integer?
Where is the main method in c#?
What is pure abstract class in c#?