I have Created Two Class Library projects (AssemblyA and AssemblyB) to distinguish the difference between the protected and protected internal access modifiers.
I have made a reference of AssemblyA in AssemblyB and used the Using Directive in the code of AssemblyB.
Class Library Project (AssemblyA)
using System;
namespace AssemblyA
{
public class AClassA
{
protected int ID;
protected internal int Age;
}
}
Class library project (AssemblyB)
using System;
using AssemblyA;
namespace AssemblyB
{
public class BclassA : AClassA
{
public void print()
{
this.ID = 1;
this.Age = 22;
// I can access both these fields here.
// How come the protected internal field gets the
// access when its between two assemblies?
}
}
}