开发者

Side effects of defining a structure inside a class

开发者 https://www.devze.com 2023-03-11 13:44 出处:网络
A newbie vb.net quest开发者_JS百科ion What is the side effects of defining a structure inside a class (name it X), and create a property inside that class of the type X?There are no side-effects.

A newbie vb.net quest开发者_JS百科ion

What is the side effects of defining a structure inside a class (name it X), and create a property inside that class of the type X?


There are no side-effects.

The only effect is that the structure is within the scope of the class, that is, if you want to use the scope from outside the class it has to be declared as Public and you nee to qualify the name explicitly as OuterClassName.InnerStructureName when using it.

Notably (and unlike in Java), the structure is not related to any instance of the class it’s contained in. So it cannot just access its surrounding class’s instance members.

0

精彩评论

暂无评论...
验证码 换一张
取 消