How to limit access to a containing class?

  • Thread starter Thread starter Brian Tkatch
  • Start date Start date
B

Brian Tkatch

Guest
I'm not terribly familiar with protection. Here's an example of what i want to do:


Class Outer
Friend Class Inner
Private A As Integer
Private B As Integer
Private C As Long

Sub Set_Values(Some_Object As whatever)
A = Some_Object.A
B = Some_Object.B
C = Some_Object.C
End Sub

Friend Function Get_A() As Integer
Return A
End Function

Friend Function Get_B() As Integer
Return B
End Function

Friend Function Get_C() As Long
Return C
End Function
End Class
End Class


The idea is to make the variables writeable from Outer, but readable from outside Outer. I did not want to use Property, because all three variables are set from the same object. They are set multiple times. I could probably make Inner itself private, and move the Gets to Outer, but i was wondering if it could be done all in one class. It would also help me understand Access Levels a little better.

Continue reading...
 
Back
Top