You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can abstract keyword come anywhere before or after public keyword in method declaration? #12183
In the example above, the class named ShapeClass has an abstract method Area. I'm doubtful about the syntax of the method declaration. Can abstract keyword come anywhere before or after public keyword in method declaration? It's used as: abstract public int Area(); Is it correct? or Should it be like: public abstract int Area();
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: c00e23c2-618d-0b84-8ea8-0b0b4de1101a
Version Independent ID: 8c00f924-bf5a-a748-331d-3809321e5547
Activity
svick commentedon May 4, 2019
Yes, that code is correct. Though
public abstractis the more common way, so maybe the documentation should be changed anyway?(BTW, that example is odd:
Areais not verb, either the method should be calledGetArea, or, even better, it should be a property.)rubbalbhusri commentedon May 5, 2019
Thanks for your kind reply. The Area is considered as a verb because it does something, it involves the calculation taking field values.
BillWagner commentedon May 6, 2019
Thanks for pointing this out @carljfoster
And for the clarifying comments @svick
I've added this to our backlog, and added the "up for grabs" label.