Re: A little problem defining a variable
François Van Lerberghe <[email protected]>
| Newsgroups | gmane.comp.lang.realbasic.user |
|---|---|
| Message-ID | <[email protected]> |
Hello Jena-Luc, I see 2 ways : 1) you can cast the ContainerControl object : dim obj1 As Object1 dim obj2 As Object2 if myContainerControlObject isa Object1 then obj1 = Object1(myContainerControlObject) elseif myContainerControlObject isa Object1 then obj2 = Object2(myContainerControlObject) end if 2) you can use ClassInterface and play with method defined in this ClassInterface Have a good day. François Van Lerberghe Thier Monty, 15 A 4570 Marchin (Belgium) +32 (0) 85 25 08 25 Le 20 juin 2017 à 11:44, Jean-Luc Arnaud <jean-luc-E/[email protected]> a écrit : > Hi all, > > I'm facing a little problem when defining a variable. > > My project has two ContainerControls, each of them representing graphically two objects very equivalent but not totally identical. > > In my code, I have to define a variable representing only one of these objects, but I don't know, when defining it, what object. > > Here is my problem: How to define a variable I don't know the type (Object1 or Object2), based on class ContainerControl? > > I tried to define it as ContainerControl, but can't assign it later the type Object1 or Object2. > > I tried to define it as Object1, but can't redefine it as Object2 is needed. > > I'm sure the solution is obvious, but can't figure it out. > > TIA for your help. > > -- > Jean-Luc Arnaud > > > > > To unsubscribe click: <http://email.lists.xojo.com/u/eJwNzMsNwyAMANBpwo2IhAL2gUNHMf4kSKGVUNr52zfAk7qDbOB6hZwTIaPnsIm3QsEHKMmDIWHELSvD8ggs43Pdfah0Wm26s0LKYClJs8ayQyqMUYNGKJytIblZbX7pdelsOo9T_8sxqF8rv4e767I_fx57KG8> > To unsubscribe click: <http://email.lists.xojo.com/u/eJwNzEsOgyAUAMDTyA7jQ74LFiJ6jydQSiKaYL1_mQNMtExH0KRYpbzgGzjq5SooN5pTt65At30B73YnZqEGPuWK5RzDXcnXogrBHLoHycwSP5OSmiEAjxi5lkCazeFsL20JzwOfEuj15p7UsTdXGu-Wyc8ObPkDlY8mrQ>