简体   繁体   中英

F# Is it possible to have an interface implement an interface?

Is it possible to do something like this:

type face1 = 
    interface
    // ...
    end

type face2 =
    interface
    // ...
    interface face1 with
    // ...
    end

Such that anything that interfaces face2 can also be considered a face1?

It's not possible to implement an interface, but you can have one interface inherit another:

type face1 = 
    interface
    end

type face2 =
    interface
        inherit face1
    end

This way implementors would need to provide face1 implementation in addition to whatever face2 asks for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM