#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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s