Functions performing the similar action on different objects

M

MikeB

I think what I'm referring to is called Overtyping in other languages
such as Java. It refers to the ability of the language where you can
have similar functions, names similarly, but operating with different
argument types (objects).

So if I want an Add function, I can have an Add function for Integer,
one for Long, etc. They're all called Add and the compiler figures
out, based on the type of arguments in the function call, which
function to invoke.

Does VBA have the same capability?

Let's say I want to list all the properties of all the objects in the
DBEngine collection.

Can I write (somehow) a ListProperties function that can take as an
argument a Workspace object, or a Database object? or do I have to
write two different functions, one called DBEProperttes and
WkspcProperties to list the properties of the different objects?

Is there some way to cast objects in VBA?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top