静态成员函数,没有public / private / etc. [英] static member function, with no public/private/etc.
问题描述
如果我这样做会发生什么:
静态字节MemberFunction()
而不是:
公共静态字节MemberFunction()
我知道我无法访问它。但它默认是什么?私人的?我不能找到任何执行此操作的代码,而静态 docs不多说。
谢谢
Zytan
What happens if I do this:
static byte MemberFunction()
instead of:
public static byte MemberFunction()
I know I can''t access it. But what does it default to? Private? I
can''t find any code that does this, and "static" docs don''t say much.
thanks
Zytan
推荐答案
Zytan写道:
Zytan wrote:
如果我这样做会发生什么:
静态字节MemberFunction()
而不是:
公共静态字节MemberFunction()
我知道我无法访问它。但它默认是什么?私人的?我不能找到任何执行此操作的代码,而静态 docs不多说。
What happens if I do this:
static byte MemberFunction()
instead of:
public static byte MemberFunction()
I know I can''t access it. But what does it default to? Private? I
can''t find any code that does this, and "static" docs don''t say much.
是 - 私人。
Arne
Yes - private.
Arne
是 - 私人。
谢谢Arne!
Zytan
Yes - private.
Thanks Arne!
Zytan
Zytan< zy * *********@yahoo.comwrote:
Zytan <zy**********@yahoo.comwrote:
如果我这样做会发生什么:
静态字节MemberFunction()
而不是:
公共静态字节MemberFunction()
我知道我无法访问它。但它默认是什么?私人的?我不能找到任何执行此操作的代码,而静态 docs不多说。
What happens if I do this:
static byte MemberFunction()
instead of:
public static byte MemberFunction()
I know I can''t access it. But what does it default to? Private? I
can''t find any code that does this, and "static" docs don''t say much.
C#使用制定默认的优秀政策。隐私级别
当时可以使用的最私密的。所以,例如:
class Outer
{
class Nested
{
}
}
类Outer.Nested是私有的(因为这是最严格的
访问嵌套类)但是类Outer是内部的(因为这是对顶级类最严格的访问权限)。
-
Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet 博客: http://www.msmvps.com/jon.skeet
如果回复该组,请不要给我发邮件
C# uses the excellent policy of making the "default" privacy level the
most private that can be used at the time. So, for instance:
class Outer
{
class Nested
{
}
}
The class Outer.Nested is private (because that''s the most restrictive
access for a nested class) but class Outer is internal (because that''s
the most restrictive access for a top-level class).
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
这篇关于静态成员函数,没有public / private / etc.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!