What does Protected Internal mean in .Net [duplicate]

It’s a confusing one. protected means “only this class and derived classes”. internal means “only classes in this assembly”. protected internal means “protected OR internal” (any class in the same assembly, or any derived class – even if it is in a different assembly). i.e. it does not mean “protected AND internal” (only derived classes … Read more

Default properties in VB.NET?

Well, the .NET framework does have a notion of a default member. Key ingredients are the DefaultMemberAttribute class and Type.GetDefaultMembers(). In VB.NET, specifying the default member is part of the language syntax: Public Class Sample Private mValue As Integer Default Public ReadOnly Property Test(ByVal index As Integer) As Integer Get Return index End Get End … Read more

What’s the deal with Java’s public fields?

Public fields expose the representation of an object to its callers, i.e. if the representation has to change, so do the callers. By encapsulating the representation, you can enforce how callers interact with it, and can change that representation without having to modify the callers provided the public api is unchanged. In any non-trivial program, … Read more