Wednesday 15 June 2011

c# - How internal specifier works -



c# - How internal specifier works -

i seek utilize internal in baseclass, msdn told me internal class can't instantiate in other method or class , produce error, why can still instantiate baseclass in method main()?

testaccess.cs

internal class baseclass { public static int intm = 0; } class testaccess { static void main() { baseclass mybase = new baseclass(); // cs0122 should error because baseclass internal class. } }

you misunderstood msdn. internal means class visible within assembly contains it. illustration posted valid.

msdn says,

it error reference type or fellow member internal access outside assembly within defined.

(emphasis mine)

c# internal

No comments:

Post a Comment