Link to home
Start Free TrialLog in
Avatar of clbit-org
clbit-org

asked on

A Question

In my project , I have three class A , B , C .

In class A
{
      Dim b as new B
}

And In class C , I want to manage variable b  . How can I do that ?
Avatar of kalyan258
kalyan258

use public b as new B

Hope you can access it from class C - if u create an instance for A.
Check this code:

Imports System.Diagnostics

Public Class B
    Public b As Integer = 3
    Public Sub test()
        Debug.WriteLine("Hi from B : " + b.ToString())
    End Sub
End Class

Public Class A
    Public b As New b
    Public Sub test1()
        Debug.WriteLine("Hi from A")
    End Sub
End Class

Public Class c
    Sub tester()
        Dim c As New A
        c.test1()
        c.b.test()
        c.b.b = 4
        Debug.WriteLine(c.b.b.ToString())
    End Sub
End Class

Module Module1

    Sub Main()
        Dim c As New c
        c.tester()
    End Sub

End Module
output is

Hi from A
Hi from B : 3
4

does this help solve your query.

Check this from with IDE as debug.writeline will not produce output in command window - it will produce results in output window in the bottom.

Cheers...
class A = super class
class C = sub class
ASKER CERTIFIED SOLUTION
Avatar of kalyan258
kalyan258

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial