Question Invalid cast

whwar9739

Member
Ok I am trying to avoid getting casting errors but so far I have not found a way to test a type cast. Does anyone here know of a way to test a type cast?
 

whwar9739

Member
Well 2 seconds after posting I found VALID-OBJECT, still have to test to see if that will do as I expect or not. Comments are still welcome on any good practices for this.
 

TomBascom

Curmudgeon
Perhaps you could show an example of the code that is perturbing you? It is much easier to make comments about code that is posted rather than code that is some sort of theoretical abstraction of an idea floating around in a cloud somewhere.
 

RealHeavyDude

Well-Known Member
I use the factory design pattern and therefore cast very often in the ABL. Never had any issue with it. What exactly is it that you want to achieve with your test?

You don't need to cast to find out the type of an object: The type-of function is your friend.
Code:
type-of ( object-reference , object-type-name ).


Heavy Regards, RealHeavyDude.
 
Top