Module Module1 Sub Main() Dim oMyTest As New MyTest oMyTest.CreateMyName("Call From OutSide, Why Can't I assign directly to MyName") 'oMyTest.MyName = ("Why Can’t I DO THIS") End Sub End Module Public Class MyTest Private MyName As String Public Sub CreateMyName(ByVal sString As String) MyName = sString Console.WriteLine(MyName) Dim oMyTest As New MyTest ' oMyTest.MyName = "Why does this work" ' why does this work ' if I initiate a the same class object inside the same class i can access all private fields, function, and methods. Console.WriteLine(MyName) Console.WriteLine("Inside Obect: " & oMyTest.MyName) End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)