Skip to content

Can abstract keyword come anywhere before or after public keyword in method declaration? #12183

Closed
dotnet/samples
#885

Description

@rubbalbhusri

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.

Activity

  1. svick commented on May 4, 2019

    @svick
    Member

    Yes, that code is correct. Though public abstract is the more common way, so maybe the documentation should be changed anyway?

    (BTW, that example is odd: Area is not verb, either the method should be called GetArea, or, even better, it should be a property.)

  2. rubbalbhusri commented on May 5, 2019

    @rubbalbhusri
    Author

    Thanks for your kind reply. The Area is considered as a verb because it does something, it involves the calculation taking field values.

  3. added and removed
    ⌚ Not Triaged
    on May 6, 2019
  4. added this to the Backlog milestone on May 6, 2019
  5. added
    help wanted
    on May 6, 2019
  6. BillWagner commented on May 6, 2019

    @BillWagner
    Member

    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.

  7. removed this from the Backlog milestone on Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ⌚ Not Triageddotnet-csharp/svchelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions