Consider this example of polymorphism. I have two different API, IWrite and IRead, and then a single implementation of these.interface IRead{    Entity Find(int id);}interface IWrite{   void Persist(Entity);}class SomeRDBMSRepository : IRead, IWrite{   public void Persist(Entity entity)   {      ...persist it   }   public Entity Find(int id)   {      ...return an entity   }}Because the implementation has all the details of how to implement the interfaces, then we could easily use the same type,  SomeRDBMSRepository. We could have several clients of the APIs, maybe like these: class FindUserQueryHandler    {        public FindUserQueryHandler(IRead readEntities)        {        }        public User Handle(int id)        {            return _readEntities.Find(id);        }    }class RegisterUserCommandHandler{    public RegisterUserCommandHandler(IWrite writeEntities)    {    }    public void Handle(User user)    {        _writeEntities.Persist(user);    }}When we want to stress the idea of polymorphism, then we simply create new types that provide different functionality. We give this example when we have, let's say, a requirement that the users must be queried from a different repository, then we could create a new type, SomeNoSQLRepository : IRead and in this way FindUserQueryHandler can use an instance of this implementation without caring about its actual details, as long as the type implements the IRead API. Also FindUserQueryHandler doesn't have to do anything special (ie to change)Someone asked me a while ago for an example of polymorphism (cough / interview) and I gave him the example of SomeRDBMSRepository because I think this type has different roles or responsibilities for different clients. For a query type is the reader, while for the command is the writer. So my reason was this type is poly because it has the IRead form and the IWrite form in the same time. It seems I was wrong.While reading the polymorphism definition from Wikipedia, I could adapt it to the meaning that if we can use any type in the place where some API is expected, as long as that type implements the clearly defined API, then that code is polymorphic. The mechanics don't really mater. C# or Java requires to specify that a class implements an interface, but for a language like Go there is enough to be a match of the method signatures between the type and interface.Wikipedia also says that a polymorphic type is a type that has operations that can accept objects of different types. In my example the query and command types are polymorphic types by this definition.Basically my question is: is there a taxonomy for SomeRDBMSRepository? How wrong I was?
If polymorphism is the ability of different types to share the same interface, is there a name for a single type that fulfills different interfaces?
object oriented;interfaces;polymorphism
First of all, your definition is wrong. You are using the term type incorrectly. Here is your definitionpolymorphism is the ability of different types to share the same interfaceTypes don't have interfaces; interfaces are types. Polymorphism is in fact the ability of expressions to take on multiple types. In OOP, the expressions are objects and the types are interfaces. The example you gave is correct. An object of class SomeRDBMSRepository actually has three types: SomeRDBMSRepository, IRead, and IWrite, so it is polymorphic (trimorphic?). Your interviewer was wrong in this instance, which unfortunately happens quite often in tech interviews.