Tuesday, 21 February 2017

abstract class example program in c#


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

namespace ConsoleApplication16
{
    public abstract class A
    {
        public abstract void show(); //abstract method with method declaraion
    }

    public class B:A
    {

        public override void show()  //method implementation with override keyword
        {
            Console.WriteLine("abstratct class and abstract method");
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            B b1 = new B();
            b1.show();
        }
    }

}

output screenshot:







No comments:

Post a Comment