hi everyone! ))
As I understand it - to a class B inherit fields and methods of class A must describe them in this order -
public class A

{
    public method34()
        {
           int m = 34;
        }

    public class B
    {
        private int my_m;

        public method1()
        {
          int m = 1;
        }
        public method2()
        {
           int m = 2;
        }
    }
}

–°an I can then use similar code in other code file -

namespace TruckingProject
{
    public partial class MainForm1 : Form
    {
        public MainForm1()
        {
            InitializeComponent();
             B bb = new B();
             If (a<0) B.method34;
        }
}

if not - what should I change? (may be -should add something to the namespace)
Thanks for you answers )

Edited 5 Years Ago by vedro-compota: n/a

First, your methods have no return type, so it won't even compile.
Second, the variables you declare in the methods only exist in that method.
Third, the proper way to declare a nested class would be A.B bb = new A.B() Forth, B does not inherit methods from A, so the if statement won't work.

Do you really mean nested classes, or did you mean to inherit A in B?

Edited 5 Years Ago by Momerath: n/a

Comments
++++++++

Do you really mean nested classes, or did you mean to inherit A in B?

you are right )) I'm.....I will not say who ))

This question has already been answered. Start a new discussion instead.