1

Inside a class by default everything is private. By default non nested class ,interface, struct, delegate & enum have internal accessibility. But that means if all these comes inside class, everything will become private by default. Are there any types that will become non private inside a class by default?

PS. just a kind of exceptional case like an instance variable that we can't assign any values inside a struct, but by using null coalescing operator we can assign.

4

1 回答 1

1

请阅读http://msdn.microsoft.com/en-us/library/ms173121.aspx

结构成员,包括嵌套类和结构,可以声明为公共、内部或私有。类成员,包括嵌套类和结构,可以是公共的、受保护的内部的、受保护的、内部的或私有的。类成员和结构成员(包括嵌套类和结构)的访问级别默认为私有。不能从包含类型外部访问私有嵌套类型。

(强调我的)。

于 2013-11-04T12:29:58.730 回答