Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What are the access-specifiers available in c#?

Answer Posted / kedarnath

1.Private:Members declared as private under a class or structure can’t be accessed outside of the type in which they are defined and moreover their scope is private only. Types cannot be declared as private where it is applicable only to members.
NOTE: Interfaces cannot contain any private members in them and default scope for interface members is public.
2.Protected:Members declared as protected under a class can be accessed only from itself or its child class, a non child class can’t consume them. Type can’t be declared as protected also. It applies only to members.
3.Internal:Members and types that are declared as internal are also accessible only within the project both for child and non child. The default scope for any type in C# is internal only.
4.Protected Internal:Members declared as protected internal enjoy dual scope i.e with in the project they behave as internal providing access to everyone in the project, outside the project they change to protected and still provide access to their corresponding child classes.
Types are also declared as protected internal only.
5.Public:A type or member of a type if declared as public will be global in scope which can be accessed from anywhere.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain lock, monitors, and mutex object in threading.

915


What are floating point numbers?

994


What is msil in c#?

953


What is streamreader/streamwriter class?

925


What is the difference between the debug class and trace class? Documentation looks the same.

1161


How to use the sreamReader class to read form a text file?

993


Can an exception be thrown from a catch block?

1025


What is view model in c#?

849


What language is c# similar to?

922


How to declare a property in a class?

1008


Is it possible to have different access modifiers on the get/set methods of a property?

1026


Why do we Need of static class in c#?

1065


What are the steps for creating clr trigger

1043


What is meant by enumerable in c#?

963


Describe the process of “exception handling implementation” in c#?

975