I have a class library with 2 public classes that inherit from an abstract class. On the abstract class I have a protected field that should only be accessible to the inherited classes. The type used for the field is that of an internal class.
For example I have:
internal class MyInternalClass
{
...
}
public abstract class MyAbstractClass
{
protected MyInternalClass myField;
}
Now I understand that this won't work because if one of the classes deriving from MyAbstract class is extended outside of the assembly, access to myField would be illegal.
My question is how can I get things working while keeping MyInternalClass internal (it should not be accessible outside the assembly) and allowing classes within the assembly to extend MyAbstractClass with access to myField?