Let me rephrase this question, because I don't know how to summarize

Class MyBaseClass
End Class
Class MyClassA Inherits MyBaseClass
   Shared Function MyFunction as String
      return "HelloA"
   End Function
End Class

Class MyClassB Inherits MyBaseClass
   Shared Function MyFunction as String
      return "HelloB"
   End Function
End Class

Sub Action()

   dim A(-1) as MyClassA
   dim B(-1) as MyClassB


End Sub

Sub SomeMethod(x() as MyBaseClass)
    // because x no elements I can't call a method nor can I call a shared method.
    // given x I need to call the shared Function MyFunction and I do not know how!
    // Is introspection going to assist me here in determining the derived class type of x as MyClassA or MyClassB?
    // Help! :)
End Sub

What is it you’re trying to accomplish ?

And no I don think introspection can tell as there are no members to introspect

So… correct me if I’m wrong, but you want to call the shared method on x so that you can determine if x is of type MyClassA or MyClassB? If thats what you are trying to do you should use IsA and test each element of x with that to determine their type. (You could then cast x to the proper type then and call appropriate methods for each class.)

It’s not clear what exactly you are trying to do. Are you trying to pass in the A and B arrays so that you can fill them in the method? I’m not sure why you would be passing an empty array into the function.

I think you might want an interface that says you will have a MyFunction defined, then have MyClassA and MyClassB as that interface. Then your SomeMethod would accept “x() as MyInterface” and you’d know it had MyFunction you could call.

If x() as MyClassB then I would be able to call MyClassB.MyFunction
if x() as MyClassA then I would be able to call MyClassA.MyFunction

If x wasn’t an empty array then I would be able to call x(0).MyFunction, but I can’t do any of these.

Would you be able to explain what MyFunction is supposed to do exactly? It’s possible this is harder than it needs to be because we don’t understand what you are actually trying to do. I know you want to call MyFunction on X, but why? Bill probably has the right idea with an interface, but we need more info to be able to help you properly.

It returns a different value for each subclass of myBaseClass. Why does that matter?

You know I know I’m wrong I just haven’t figured out why…
I think this is what I need:

Sub SomeMethod(x() as MyClassB) MyClassB.MyFunction End Sub Sub SomeMethod(x() as MyClassA) MyClassA.MyFunction End Sub
Thus due to the different signature I am able to call the right shared method.

But is there some reason it needs to be called on an empty array?

You could make the method like this:

Sub SomeMethod(x as myBaseClass) if x isa MyClassB then MyClassB(x).myFunction //cast to MyClassB elseif x isa MyClassA then MyClassA(x).myFunction //cast to MyClassA end if End Sub
If x is nil it won’t work like you want it to though because isa will return false. Would you be able to explain what the empty array is for?

To call a shared method, you need either the class name or an instance of the class. A variable of that type doesn’t help you, unless it contains an instance. If it’s nil, you’re out of luck.

The thing is I thought that the type of the empty array would be available…
but of course it isn’t because that array could potentially have any subclass of mybaseclass so it’s my design that is just ill planned.