Create Interface

  1. 4 months ago

    Johann K

    Feb 7 Perth, Australia

    hi,
    I created a class with some empty methods, used 'Extract Interface' to add it to the interface list, but when I created a new class and chose to use the new interface my new class did not have any methods from the interface,
    what I'm doing wrong ?
    could not find any documentation about creating and using interfaces ...

  2. Kem T

    Feb 7 Pre-Release Testers, Xojo Pro, XDC Speakers Answer New York

    Try this:

    https://docs.xojo.com/UserGuide:Interfaces

  3. Johann K

    Feb 8 Perth, Australia

    thanks Kem,

    it took me a while to find out how it works, but at the end I did it.
    what I do not understand is why I have to create a property with type of my new interface first before I can use the interface,
    but it works now,

    thanks

  4. Greg O

    Feb 10 Xojo Inc

    @JohannKienbrandt thanks Kem,

    it took me a while to find out how it works, but at the end I did it.
    what I do not understand is why I have to create a property with type of my new interface first before I can use the interface,
    but it works now,

    thanks

    To be clear, you can also cast a class using the interface. For instance, if you had an interface called Transport with a method named Carry and a class named Basket which has the Transport interface applied to it, you can still make the property of type Basket. You would just need to check at runtime...

    dim b as new Basket
    If b IsA Transport then
        Transport(b).Carry
    End if

or Sign Up to reply!