ClassA has Operator_Convert(c As Color), so when you assign the Color to Fill, you will get an instance of ClassA. If you want an instance of ClassB, you’d have to do this:
Thanks to @Norman_Palardy. We can get it work the way I want adding the following Operator_Lookup to ClassTest:
Sub Operator_Lookup(name As String, Assigns newValue As Variant)
Select Case name
Case "Fill"
If (newValue.Type = Variant.TypeColor) Then
Fill = New ClassB(newValue.ColorValue)
Elseif newValue.Type = Variant.TypeObject And newValue IsA Picture Then
Fill = New ClassC(Picture(newValue.ObjectValue))
End If
End Select
End Sub
ClassB and ClassC need to get an Operator_Convert method. That’s all.
Warning:Operator_Lookup overrides the compilers checking in a way that you have to really know what you are doing as a lot of compiler error will not occur any more!