jinyistudio Well-Known Member Licensed User Longtime User Jun 9, 2016 #1 Hi I have two class as following Code: Copy dim class1 as jyMbSerial dim class2 as jyMbTcp And i pass them to following function Code: Copy publice sub Setinterface(intf as object) : end sub SetInterface(class1) Or SetInterface(class2) In SetInterface,How to check intf is jyMbSerial Or jyMbTcp ??
Hi I have two class as following Code: Copy dim class1 as jyMbSerial dim class2 as jyMbTcp And i pass them to following function Code: Copy publice sub Setinterface(intf as object) : end sub SetInterface(class1) Or SetInterface(class2) In SetInterface,How to check intf is jyMbSerial Or jyMbTcp ??
Erel B4X founder Staff member Licensed User Longtime User Jun 9, 2016 #2 You can implement SetInterface in each of these classes and then call it with: Code: Copy CallSub(YourObject, "SetInterface") If you do want to check for the class type then you can use: Code: Copy If class1 Is jyMbSerial Then Dim m As jyMbSerial = class1 ... Upvote 0
You can implement SetInterface in each of these classes and then call it with: Code: Copy CallSub(YourObject, "SetInterface") If you do want to check for the class type then you can use: Code: Copy If class1 Is jyMbSerial Then Dim m As jyMbSerial = class1 ...