I recently noticed the CallByName keyword in VB6.
Since it takes an object, a procedure name, a "call type" and an array of arguments, can this be used to "fake" some types of polymorphic behavior?
I can make 2 classes, class A and B, each with the same Foo method, and do:
Dim list As New Collection Dim instanceA As New ClassA Dim instanceB As New ClassB Dim current As Object Call list.Add(instanceA) Call list.Add(instanceB) For Each current in list Call CallByName(current, "methodName", vbMethod) Next
Has anyone done this before? Problems? A terrible idea or a brilliant idea? Effects? Unintended consequences?
source share