Can we declare abstract keyword on fields in a class ?

 Posted by Akiii on 5/30/2012 | Category: C# Interview questions | Views: 2526 | Points: 40

No we cannot.

For example :-

public abstract class clsbase

public abstract string str = "Akiii";

executing the code will results in the following error :-
Error 1 The modifier 'abstract' is not valid on fields. Try using a property inste ad.

Thanks and Regards

| Alert Moderator 

Comments or Responses

Login to post response