c# access modifier section like c++

Do I need to write all access modifiers in c#?

static class Node {
    Node link;//Node * link;
    int data;

    public:
        void setlink(Node next){...}
        void display(){.....}

I want to use access modifiers section(public:, protected:)like in c++ how can I use it?
Do I have to write all of them?

public void setlink(Node next){...}
public void display(){...}

instead

public:
    void setlink(Node next){....}
    void display(){....}
Jon Skeet
people
quotationmark

Yes, you specify it on each member. Two good things about this:

  • Moving the methods around within the same class can't affect anything.
  • You can immediately see the access modifier by looking at the method declaration. No need to look higher up in the file to see if you're in a public section or not.

people

See more on this question at Stackoverflow