Java, .NET, PHP, PYTHON, ANGULAR, .NET, ML, Data Scince, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

Abstract class in C#:-  


It is a special class of C# which contains a normal method and abstract method, we can not create object of abstract class it will be implemented by the normal class.

An abstract class is used to declare a set of rules using the abstract method but we can not perform multiple inheritances using this.



Syntax:-

abstract class Classname
{
       void methodname()
      {

       }

      abstract void methodname();

}

note:-  all abstract methods must be overridden,we will use abstract keyword in class and method both.


We can not create an object of abstract class hence it is also used to perform data abstraction.

abstract class  Area
    {
       internal void rect()
       {
       }
      abstract internal  void triangle();
     
    }

 class AreaLogic : Area
    {

        internal override void triangle()
        {
            Console.WriteLine("Triangle");
        }
     
        static void Main()
        {
            Area obj = new AreaLogic();
            obj.rect();
            obj.triangle();
         
            Console.ReadKey();
        }
    }

    

Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post