简体   繁体   中英

labeling a group of members as private/public in c#

in a c++ class declaration, you can label a group of members as private or public, eg

private:
  int x;
  double y;

seems like there's no way to do this in c#. am I wrong?

No, you can't not do this in C#.

At best, you can use the default visibility for members, which is private, and not use private, but for public, you have to indicate it for all members.

You're correct. Although, if you leave visibility keyword off altogether, a member defaults to private.

No you're not wrong. If you don't write any modifiers it will be assumed as private.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM