方法,无需访问修饰符 [英] method without access modifier

查看:170
本文介绍了方法,无需访问修饰符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

确定这是窃听我..我知道我在什么地方读它和谷歌是没有帮助的。

Ok this is bugging me.. I know I've read it somewhere and google isn't helping.

什么是方法的访问级别,不指定一个访问修饰符?

What is the accessibility level of a method that does not specify an access modifier?

void Foo()
{
    //code
} 

我想说内部,但我不是100%肯定。

I want to say internal but I'm not 100% sure.

推荐答案

默认的辅助功能的键入内部,但默认accesibility该类型的成员取决于类型。

The default accessibility for a type is internal, but the default accesibility of that type's members depends on the type.

一般而言,类的成员私人默认情况下,在这里作为一个结构的成员公开默认情况下。这会因语言;默认结构的C ++是公开的,在这里为C#,他们是私人的访问修饰符。

Generally speaking, members of a class are private by default, where as members of a struct are public by default. This varies by language; default struct access modifiers for C++ are public, where as for C#, they are private.

这篇关于方法,无需访问修饰符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆