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

How to learn Azure without paid subscription

Microsoft Azure is a cloud service that is constantly expanding to help your organization meet business challenges. You can build, manage d...

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

Popular Posts