Enumerators are typically obtained by calling the method of an object implementing the interface.
Go also uses structural typing; and all types implement the empty interface: .
Any class that implements the interface can thus satisfy the dependency of a dependent class without having to change the class.
Fakes are the simpler of the two, simply implementing the same interface as the object that they represent and returning pre-arranged responses.
You can also to an object implementing the interface, which will receive various events related to the clip (starting, stopping, media finishing, etc.)
Concrete classes have to explicitly declare they implement the immutable interface.
The existing implementation is closed to modifications, and new implementations need not implement the existing interface.
Note: A more flexible approach to this pattern is to create a wrapper class implementing the interface defining the accept method.
Below is an example of a typical Java class implementing the interface:
It gives the programmer the ability to later change the behavior of the system by simply swapping the object used with another implementing the same interface.