C# how to make abstract class and how to use abstract keyword..

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

namespace abstract_keyword
{
  abstract class JHON
    {
     public  abstract void showdata();
  }
    class b:JHON{

        public override void showdata() {

            Console.WriteLine("This is test of abstract modifier");
        }
   
    }
    class c : JHON {

        public override void showdata()
        {
            Console.WriteLine("AFTER INHERITE and ovveride the result is this");
        }
   
    }

    class demo{
        static void Main(string[] args)
        {

            anas obj1 = new b();
            obj1.showdata();
            anas obj2 = new c();
            obj2.showdata();
            Console.ReadKey();

        }
    }
}

OUTPUT



No comments:

Post a Comment