2017-04-20 42 views

回答

1

當您不指定訪問修飾符時,編譯器將採用標準訪問修飾符。例如:

namespace SomeApplication 
{ 
    // This class is internal by default. 
    class SomeClass 
    { 
     //Members are private by default. 
    } 
} 

class JustSomeClass 
{ 
    // All members are private by default. 
    int ThisFieldIsPrivate; 
    private int SoIsThisOne; 
    public int FinallySomethingPublic; 
} 

// Struct 
struct JustSomeStructure 
{ 
    int TypicalPrivateMember; 
} 

HimBromBeere said in his comment,這是可能的,但你必須寫自己的編譯器,如果你想改變這個標準的行爲。