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 ?
In class A
{
Dim b as new B
}
And In class C , I want to manage variable b . How can I do that ?
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.ToSt ring())
End Sub
End Class
Module Module1
Sub Main()
Dim c As New c
c.tester()
End Sub
End Module
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.ToSt
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...
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
class C = sub class
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Hope you can access it from class C - if u create an instance for A.