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 )

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?

commented: ++++++++ +1

No, no, no)) it is not so)) sorry for the stupid))

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 ))

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.