Abstract Class in c#.net

Abstract Class:

Now we will discuss about abstract class in c#.net. 
  • Abstract class is class we cannot create object. We only use inherit
  • We are only use base class. If u r use abstract method u must implement derived class

Abstract Class Declaration

abstract class devenvexe
{

}

A abstract class can contain abstract method or non-abstract method .abstract method not have implementation in abstract class .but same its have derived class

Abstract Method/Non Abstract Method:

abstract class devenvexe
{
public abstract void abstractMethod();
public void NonAbstractMethod()
{
Console.WriteLine("NonAbstract Method");
}
}

Rules:

  • Abstract class not have sealed class
  • Abstract class only contain abstract method
  • Abstract class cannot be private
  • Abstract method cant have virtual keyword.because its explicit virtuval method
  • Abstract class cannot be static

Performance

In our testing, abstract classes with virtual methods have better performance than interface implementation .

0 Comments

Featured Post

Understanding about Azure Region, Geographies, Availability Zones and Region Pairs

Introduction Microsoft Azure services are available in 53 regions around the world, with plans announced for 7 additional regions and 140+ a...

Subscribe to the FREE Weekly Newsletter to receive all the latest Microsoft Azure, AI, Xamarin

Popular Posts