#20:Abstract Method

1.An Abstract method can be enclosed only in Abstract Class.

class test
 {
 //Error Abstract Method in Non-Abstract Class
 public abstract void hello();
}

2. Abstract Method cannot Declare Body.

abstract class test
{
//Error Abstract Method Cannot have declaration of Body
public abstract void hello()
{
}
// Correct Usage:only contract allowed.
public abstract void hello();
}

3.Abstract Method Cannot be Virtual

 //Abstract method cannot be virtual
  public abstract virtual void h();

4.You must override the Abstract Method in Class you derive.

5.Abstract Class can contain Non-Abstract Methods.

Leave a comment