How can I tell if an object is an instance of a specific type, and call type specific methods in it?
InstanceOf()
BlitzMax Forums/BlitzMax Programming/InstanceOf() Or just
Of course this will give "false" positives if inheritance is involved. I say "false" because they're not really false, but they might not be what you want. If type b is an extended class based on the base type a, then it will show as being an a ( which it is ) but it just depends if this bothers you. With good coding practices, it probably won't. I can't imagine you'd want to differentiate in this way.
If MyTypeB(a) ' IT'S A B else ' IT'S NOT A B end if
Of course this will give "false" positives if inheritance is involved. I say "false" because they're not really false, but they might not be what you want. If type b is an extended class based on the base type a, then it will show as being an a ( which it is ) but it just depends if this bothers you. With good coding practices, it probably won't. I can't imagine you'd want to differentiate in this way.
thanks alot - this really helps :D
Or just ...
Sure, except if you want to tell if an object is an instance of a specific type, and call type specific methods in it
you'll need the cast object anyway. Of course this will give "false" positives if inheritance is involved.
So will InstanceOf. :o>