In VB is there anyway of telling WHO created "this" instance of an object? ie: Was it publically created or was it created by a friend? Short of adding a friend property that can set a flag to indicate whether or not this was the case?
I don't know of any, short of the WhosYourDaddy property.
I'm seeing two different objects. Maybe just two different entities. Nope, that's definately two different objects, derrived from a common ancestor.
Your public users make the common object while friends make a specialized version with added functionality.
You can embed your base class object in the specialized class wrapping the public members making it look like they belong to your specialized class. VB provides an inherits statement that leaves a little to be desired but still helps you along this path.
Leave the Common/Base class creatable but make the specialized class non-creatable. Refraining from using the public version within your project gives you the functionality you want by allowing your to tell them apart by their TypeName. This is true even if the specialized version doesn't really add any functionality. Since each has a similar interface, they can be used almost interchangably, you know, within the object framework.
[tt] Class1:
Private x as string
Public Property Get It() As String
It = x
End Property
Public Property Let It(s As String)
x = s
End Property =====
Class2:
Private x as string
Private oBase as NEW Class1
Public Property Get It() As String
It = oBase.x
End Property
Public Property Let It(s As String)
oBase.x = s
End Property
Public Function SpecialFunc()
' Work Work, More Work
End Function [/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.