Nested instances in C#
<p>I'm trying to translate some C++ code for a neural net into C#.  I first took the C++ code, from a 1993 book, and ran it.  Then translated it using the STL and it ran again.  Now I'm trying to get it into C# with Visual Web Developer 2008 Express.</p>

<p>The original code used "friend" classes and I'm just trying to do the same making everything "public".</p>

<p>The following code compiles but only gives null references when run:</p>

<pre><code>public class ineuron
{
     public Double weight, activation;

     public ineuron(Double set_wt)
     {
         weight = set_wt;
     }
</code></pre>

<p>...</p>

<pre><code> public class netwrk
 {
     public oneuron onrn;
     public ineuron in1, in2, in3, in4;

     public netwrk( Double inp_1, Double inp_2, Double inp_3, Double inp_4 )
     {
         ineuron in1 = new ineuron(inp_1);
         ineuron in2 = new ineuron(inp_2);
</code></pre>

<p>...  </p>

<p>and later, in some code called by a button push:</p>

<pre><code>netwrk ntw = new netwrk(i_n1, i_n2, i_n3, i_n4);
</code></pre>

<p>Unfortunately, trying to use <code>ntw.in1.activation</code> etc. leads to null reference runtime errors.</p>

<p>What am I forgetting to do?</p>

<p>Barney</p>
