top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Can we declare structure as protected in C#?

+5 votes
404 views
Can we declare structure as protected in C#?
posted Nov 17, 2015 by Manikandan J

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

is YES, BUT only as an inner class. A 'normal' class cannot be protected or private.

// 'Normal' class - only default or public allowed

public class ProtectedOrNot {

  // Inner class - public, default, protected, private allowed

  protected class InnerClass {

  }

  public static void main(String[] args) {

  }

}
answer Nov 17, 2015 by Shivaranjini
...