R roiuziel Member Licensed User Longtime User Jan 2, 2013 #1 Is there a way to get the object class type. Something like instanceof command in Java. I want to make a function that can support several datatypes and that will check the object original type before deciding what to do with it. Thanks, Roi/Dodly
Is there a way to get the object class type. Something like instanceof command in Java. I want to make a function that can support several datatypes and that will check the object original type before deciding what to do with it. Thanks, Roi/Dodly
R roiuziel Member Licensed User Longtime User Jan 2, 2013 #2 Getting object data type Found this: http://www.b4x.com/forum/bugs-wishlist/19574-bug-label-does-not-work.html#post112881 The keyword IS does the trick. Upvote 0
Getting object data type Found this: http://www.b4x.com/forum/bugs-wishlist/19574-bug-label-does-not-work.html#post112881 The keyword IS does the trick.
Erel B4X founder Staff member Licensed User Longtime User Jan 2, 2013 #3 Another option is to create a method with the same signature in each class and then use CallSub to call this method. This way you do not need to check the exact object type and the object itself is responsible for handling the required task. This is sometimes referred as duck typing: Duck typing - Wikipedia, the free encyclopedia Upvote 0
Another option is to create a method with the same signature in each class and then use CallSub to call this method. This way you do not need to check the exact object type and the object itself is responsible for handling the required task. This is sometimes referred as duck typing: Duck typing - Wikipedia, the free encyclopedia