Wednesday 27 July 2016

C Sharp Constructure Inheritance Tutorial

C# Constructure Inheritance Program 

class test
    {
        int a, b;
        public test(int x,int y)
        {
            a = x;
            b = y;
        }

        public void display()
        {
            Console.WriteLine("Class test Data\nA={0}\tB={1}", a, b);
        }
    }
    class best : test
    {
        int x;
        public best(int k) : base(10,20)
        {
            x= k;
        }
        public void show()
        {
            Console.WriteLine("\nbest class Data\nX={0}",x);
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            best ob = new best(10);
            ob.display();
            ob.show();
        }
    }
Next Topic

No comments:

Post a Comment