|
-
Jul 13th, 2011, 06:42 PM
#1
Thread Starter
New Member
Variable scope in nested classes
I have put together the following code to illustrate the problems I've been struggling with:
Public Class OuterClass
Private _OuterProp1 As Boolean = False
Public Property OuterProp1 As Boolean
Get
Return _OuterProp1
End Get
Set(ByVal value As Boolean)
_OuterProp1 = value
End Set
End Property
Protected Class InnerClass1
Private _InnerProp1 As Integer = 0
Private Sub InnerSub1()
If OuterProp1 Then
_InnerProp1 = 10
End If
End Sub
End Class
Protected Class InnerClass2
Private Sub InnerSub2()
_InnerProp1 = 5
End Sub
End Class
End Class
I need to be able to refer to outer class properties and variables in an inner class, and I need to have a variable in one inner class set in a different class. I've tried Public, Private, Protected, Friend and all kinds of combinations of them, and I can't figure it out. Can someone please help me? Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|