I thought that assembly is a project in a solution in Visual Studio, but then I was trying to understand inheritance and internal/protected access modifiers and I got lost.
*Project1
and Project2
are separate VS projects in one solution:
namespace Project1
{
public class C1
{
internal int field1;
internal protected int field2;
}
}
namespace Project2
{
public class C2
{
public static void f(C1 c1)
{
c1.field1 = 1; //no problems here
c1.field2 = 2; //neither here
}
}
}
In Project2
I have no inheritance so both fields field1
and field2
should be inaccessible but there's no errors at all. (I added Project1 into Project2 References and add using Project1
in Project2
)