Mixin

Python

Python中，除了使用protocol以外，也可以用多繼承的形式來實現Mixin。為了區分普通的多繼承，mixin類的類名一般都會帶上後綴：「Mixin」，比如Python 2中的類UserDict.DictMixin。DictMixin類包括部分實現，使用者的類只要實現幾個必須的函數接口，如：__getitem__(), __setitem__(), __delitem__(), keys()。
Python的SocketServer模塊提供了UDPServer類與TCPServer類，作為UDP與TCP的socket伺服器。有兩個mixin類：ForkingMixIn與 ThreadingMixIn。通過如以下代碼的方式使用ThreadingMixIn擴展TCPServer：
class ThreadingTCPServer(ThreadingMixIn, TCPServer):
  pass
ThreadingMixIn類為TCP伺服器添加了新功能，使每個新連接都會創建出新執行緒。而如果是ForkingMixIn，則會使每個新連接fork出新的進程。

Ruby

在ruby中，並不直接使用Mixin這個單詞，而是使用在類的聲明中include一個module的辦法。

接口與trait

已隱藏部分未翻譯部分，歡迎參與翻譯。
Java 8 introduces a new feature in the form of default methods for interfaces. Basically it allows a method to be defined in an interface with application in the scenario when a new method is to be added to an interface after the interface class programming setup is done. To add a new function to the interface means to implement the method at every class which uses the interface. Default methods help in this case where they can be introduced to an interface any time and have an implemented structure which is then used by the associated classes. Hence default methods adds a possibility of applying the concept in a mixin sort of a way.
Interfaces combined with aspect-oriented programming can also produce full-fledged mixins in languages that support such features, such as C# or Java. Additionally, through the use of the  marker interface pattern, generic programming, and extension methods, C# 3.0 has the ability to mimic mixins. With C# 3.0 came the introduction of Extension Methods[2] and they can be applied, not only to classes but, also, to interfaces. Extension Methods provide additional functionality on an existing class without modifying the class. It then becomes possible to create a static helper class for specific functionality that defines the extension methods. Because the classes implement the interface (even if the actual interface doesn’t contain any methods or properties to implement) it will pick up all the extension methods also.
ECMAScript (in most cases implemented as JavaScript) does not need to mimic object composition by stepwise copying fields from one object to another. It natively supports Trait and Mixin based object composition via function objects that implement additional behavior and then are delegated via call or apply to objects that are in need of such new functionality.

Scala

Scala has a rich type system and Traits are a part of Scala’s type system which help implement mixin behaviour. As their name reveals, Traits are usually used to represent a distinct feature or aspect that is normally orthogonal to the responsibility of a concrete type or at least of a certain instance.
For example, the ability to sing is modeled as such an orthogonal feature: it could be applied to Birds, Persons, etc.
trait Singer{
  def sing { println(" singing … ") }
  //more methods}class Birds extends Singer
Here, Bird has mixed in all methods of the trait into its own definition as if class Bird had defined method sing() on its own.
As extends is also used to inherit from a super class, in case of a trait extends is used if no super class is inherited and only for mixin in the first trait. All following traits are mixed in using keyword with.
class Personclass Actor extends Person with Singerclass Actor extends Singer with Performer
Scala allows mixing in a trait (creating an anonymous type) when creating a new instance of a class. In the case of a Person class instance, not all instances can sing. This feature comes use then:
class Person{
  def tell {  println (" Human ") }
  //more methods}val singingPerson = new Person with SingersingingPerson.sing

Swift

Mixin can be achieved in Swift by using a language feature called Default implementation in Protocol Extension. 
 1 protocol ErrorDisplayable { 2     func error(message:String) 3 } 4  5 extension ErrorDisplayable { 6     func error(message:String) { 7         // Do what it needs to show an error 8         //... 9         print(message)10     }11 }12 13 struct NetworkManager : ErrorDisplayable{14     func onError() {15         error("Please check your internet Connection.")16     }17 }