user3685285
user3685285

Reputation: 6586

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?

Upvotes: 4

Views: 1518

Answers (1)

scrwtp
scrwtp

Reputation: 13577

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.

Upvotes: 6

Related Questions