On Apr 8, 2006, at 12:45 AM, Thom McGrath wrote:

If I have ClassA which has a shared property, visible, all instances of ClassA share this property, right? Well if I subclass ClassA into ClassB, do all instances of both ClassA and ClassB share this property since ClassB is a ClassA? Or do all ClassA's share a visible property and all ClassB's share a different visible property?

Shared properties belong to the class, not any given instance. I would consider it a bug that you can say instanceOfClass.sharedProp; use ClassName.sharedProp. In my simple test:

Class Class1
        Shared Property foo as integer
End Class

Class Class2 Inherits Class1
End Class

Sub Window1.Open()
        Class1.foo = 42
        msgBox( str( Class2.foo ) )
End Sub

the msgbox() shows 42. There is only one instance of any shared property, inherited by subclasses (like a method, except you can't shadow it).

HTH!

-- Asher

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to