Access Modifier, Inheritance and Foreign Assembly
<p>let's say I have a baseClass in myFramework namespace:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Text;

namespace myFramework
{
    public class baseClass
    {
        internal int m_value;

        internal int getValue() {
            return m_value;
        }

        internal void setValue(int value) {
            m_value = value;
        }

    }
}
</code></pre>

<p>In MyApplication namespace I inherit from it:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Text;
using myFramework;

namespace MyApplication
{
    class InheritedClass: baseClass
    {
    }
}
</code></pre>

<p>In a form in MyApplication namespace I use it:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using myFramework;

namespace MyApplication
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            InheritedClass inheritedClass = new InheritedClass();

            inheritedClass.setValue(10);
            textBox1.Text = inheritedClass.m_value.ToString();
        }
    }
}
</code></pre>

<p>As you can see I have declared m_value with internal modifier so that I can access it from Form.</p>

<p>Now what if I compile myFramework in a separate assembly ? internal won't work any more ? So is there any modifier I can use ? Protected can't even do less the job. Am I obliged to use public ?</p>

<p>Isn't there an access modifier that allows an object (form) which OWNS a class (inheritedclass) to access all the members of all class and parent class he owns like internal except that internal doesn't consider ownership but where the class has been declared ?</p>

<p>Update: of course in real world use, my base class has tight semantics with form (or view) so it's up to me to decide if I should do it, my question is not if I should do, my question is if it is possible or if I will be obliged to use stuff like Design by Contracts which I find silly to add yet another tool for such basic requirements.</p>
