Skip to main content

Constructors in inheritance in c sharp #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace My
{
    class abc
    {
       public abc()
        {
            Console.WriteLine("this is a base constructor");
        }
       public  void display()
        {
            Console.WriteLine("this is a base");
        }

    }
    class abc2 : abc
    {

       public abc2():base()
        {
        }
       public   void display()
        {
            base.display();
            Console.WriteLine("this is a derived");

        }

    }
    class MyClass
    {


        static void Main(string[] args)
        {
            abc2 ob = new abc2();
            ob.display();
            Console.Read();


        }
    }
}

Comments

Popular posts from this blog

unix commands