Ask Question
20 April, 23:29

What are the field/method access levels (specifiers) and class access levels?

+2
Answers (1)
  1. 20 April, 23:55
    0
    There are 5 access specifiers totally in C#

    Explanation:

    In C# there are 5 different access specifiers.

    1. Private

    2. Protected

    3. Internal

    4. Protected Internal

    5. Public

    Fields or methods can have all the access modifiers, where as classes can have only 2 (internal, public) of the 5 access specifiers.

    I have explained the usage of each access modifier below.

    Private:

    Private members are available only with in the containing type.

    Public:

    Public members are available any where. There is no restriction.

    Internal: Internal members are available anywhere in the containing assembly.

    Protected:

    Protected Members are available, with in the containing type and to the types that derive from the containing type.

    Protected Internal:

    These are available anywhere within containing assembly and from within a derived class in any another assembly.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What are the field/method access levels (specifiers) and class access levels? ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers