Here is the VB.NET code snippet
Public Class OOPDemo Private _strtString as String Public Function Func(obj as OOPDemo) as boolean obj._strString = "I can set value to private member using a object" End Function End Class
I thought we could not access private members using this object, but maybe the CLR allows us to do this. This means that access modifiers are based on a type, not an instance of that type. I also heard that C ++ also allows this.
Any guesses what could be causing this?
Edit:
I think this line from the msdn link provided by RoBorg explains this behavior: "Code in a type that declares a private element, including code inside contained types, can access the element"
oop access-specifier
MOZILLA
source share