Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7645233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:53:20+00:00 2026-05-31T09:53:20+00:00

Possible Duplicate: What is the difference between 'protected' and 'protected internal'? What is the

  • 0

Possible Duplicate:
What is the difference between 'protected' and 'protected internal'?
What is the difference between Public, Private, Protected, and Nothing?

Code is as mentioned below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace testanotherlib
{
    public class A
    {
        internal void InternalDisplay()
        {
            Console.WriteLine("Internal Display Method.");
        }

        protected void ProtectedDisplay()
        {
            Console.WriteLine("Protected Display Method.");
        }

        protected internal void ProtectedInternalDisplay()
        {
            Console.WriteLine("ProtectedInternal Display Method.");
        }

        public void PublicDisplay()
        {
            Console.WriteLine("Public Display Method.");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace testanotherlib
{
    public class B : A
    {
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using testanotherlib;
namespace testlib
{
    public class C:A
    {
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using testlib;
using testanotherlib;

namespace testapp
{
    class Program
    {
        static void Main(string[] args)
        {
            B objB = new B();
            C objC = new C();
        }
    }
}

I am trying to understand the difference between Internal, Protected and Protected Internal. For that I have created an example using the code above.

In a class library project testanotherlib I have class A & class B. In a class library project testlib I have class C. The program class is in a separate console application. Inside the main method of Program class I have created object for class B (objB) and class C (objC). For objB and and objC only the public method of class A are accessible. I was expected for class B all the methods of class A will be accessible. Kindly help me to understand this. If you need any other information about the project, feel free to ask me.

Regards,
Priyank

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:53:22+00:00Added an answer on May 31, 2026 at 9:53 am

    The following five accessibility levels can be specified using the access modifiers:

    public: Access is not restricted.

    protected: Access is limited to the containing class or types derived from the containing class.

    Internal: Access is limited to the current assembly.

    protected internal: Access is limited to the current assembly or types derived from the containing class.

    private: Access is limited to the containing type.

    Taken directly from Microsoft’s MSDN library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Difference between private, public and protected inheritance in C++ One of the
Possible Duplicate: Ruby: difference between || and ‘or’ Using Ruby || and or are
Possible Duplicate: Difference between using var and not using var in JavaScript For the
Possible Duplicate: Difference between void main and int main? Alright, so I'm using bloodshed
Possible Duplicate: Difference between using var and not using var in JavaScript Hello, I
Possible Duplicate: Difference between Property and Field in C# public class Test { public
Possible Duplicate: Difference between lock(locker) and lock(variable_which_I_am_using) In all of the thread-safe code examples
Possible Duplicate: Difference between using var and not using var in JavaScript var foo
Possible Duplicate: Difference between using var and not using var in JavaScript What is
Possible Duplicate: What are access specifiers? Should I inherit with private, protected or public?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.