The problem is that nested classes are not derived classes, so the methods in the outer class are not inherited.
Some options are
-
Make the method
static
:class Neuro { public class Net { public void SomeMethod() { int x = Neuro.OtherMethod(); } } public static int OtherMethod() { return 123; } }
-
Use inheritance instead of nesting classes:
public class Neuro // Neuro has to be public in order to have a public class inherit from it. { public static int OtherMethod() { return 123; } } public class Net : Neuro { public void SomeMethod() { int x = OtherMethod(); } }
-
Create an instance of
Neuro
:class Neuro { public class Net { public void SomeMethod() { Neuro n = new Neuro(); int x = n.OtherMethod(); } } public int OtherMethod() { return 123; } }