C#修饰符总结

来源:互联网 发布:linux coredump 编辑:程序博客网 时间:2024/05/17 01:12

C#修饰符总结


An enum has default modifier as public

A class has default modifiers as Internal . It can declare members (methods etc) with following access modifiers:
public
internal
private
protected internal

An interface has default modifier as public

A struct has default modifier as Internal and it can declare its members (methods etc) with following access modifiers:
public
internal
private

A methods, fields, and properties has default access modifier as "Private" if no modifier is specified.


For default constructors:

If the class is abstract then the declared accessibility for the default constructor is protected.

Otherwise, the declared accessibility for the default constructor is public.

原创粉丝点击