• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 13. Exploiting the Power of Clas... > Adding a Parent Property to Classes

Adding a Parent Property to Classes

Many Microsoft-generated objects have a Parent property. This property generally provides a reference back to the parent of an object in a hierarchy. You can emulate this behavior in your own classes. Place this code in the child class:

Private mobjParent As Order

Public Property Get Parent() As Order
    'Return the pointer stored in mobjParent
    Set Parent = mobjParent
End Property

Public Property Set Parent(ByVal objParent As Order)
    If mobjParent Is Nothing Then
        Set mobjParent = objParent
    End If
End Property


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint