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

MSDEVBUILD in Feedspot Top 100 Microsoft Azure Blogs

I am pleased to announce my blog msdevbuild.com again has been listed on the popular Feedspot website as one of the Top 100 Microsoft Azure...

Popular Posts