16.5 Type declarations

王朝other·作者佚名  2006-05-06
窄屏简体版  字體: |||超大  

A type-declaration is a class-declaration (§17.1), a struct-declaration (§1

8.1), an interface-declaration

(§20.1), an enum-declaration (§21.1), or a delegate-declaration (§22.1).

type-declaration:

class-declaration

struct-declaration

interface-declaration

enum-declaration

delegate-declaration

A type-declaration can occur as a top-level declaration in a compilation

unit or as a member declaration

within a namespace, class, or struct.

When a type declaration for a type T occurs as a top-level declaration in a

compilation unit, the fully

qualified name of the newly declared type is simply T. When a type

declaration for a type T occurs within a

namespace, class, or struct, the fully qualified name of the newly declared

type is N.T, where N is the fully

qualified name of the containing namespace, class, or struct.

A type declared within a class or struct is called a nested type (§17.2.6).

The permitted access modifiers and the default access for a type

declaration depend on the context in which

the declaration takes place (§10.5.1):

? Types declared in compilation units or namespaces can have public or

internal access. The default

is internal access.

? Types declared in classes can have public, protected internal, protected,

internal, or

private access. The default is private access.

? Types declared in structs can have public, internal, or private access.

The default is private

access.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航