2015-11-14 17:38:35 +08:00
|
|
|
|
---
|
|
|
|
|
layout: pattern
|
|
|
|
|
title: Twin
|
|
|
|
|
folder: twin
|
|
|
|
|
permalink: /patterns/twin/
|
2016-08-30 15:10:34 +02:00
|
|
|
|
pumlid: 7SR13OCm30NGLUW0n7UsCS42eyH4zdUpFbNVwNtKQij3qjjo0ICs8kTPJiMLUuPuVGnYAFNff2qdWvrk_l9wIEXfws10t88wno-4gKQ2-az9xsLaRoy0
|
2015-11-14 17:38:35 +08:00
|
|
|
|
categories: Creational
|
2015-12-28 15:52:44 +02:00
|
|
|
|
tags:
|
|
|
|
|
- Java
|
|
|
|
|
- Difficulty-Intermediate
|
2015-11-14 17:38:35 +08:00
|
|
|
|
---
|
|
|
|
|
|
2016-01-03 21:14:30 +01:00
|
|
|
|
## Intent
|
|
|
|
|
Twin pattern is a design pattern which provides a standard solution to simulate multiple
|
2015-11-14 17:38:35 +08:00
|
|
|
|
inheritance in java
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
2016-01-03 21:14:30 +01:00
|
|
|
|
## Applicability
|
|
|
|
|
Use the Twin idiom when
|
2015-11-14 17:38:35 +08:00
|
|
|
|
|
|
|
|
|
* to simulate multiple inheritance in a language that does not support this feature.
|
2015-11-16 10:01:03 +08:00
|
|
|
|
* to avoid certain problems of multiple inheritance such as name clashes.
|
|
|
|
|
|
2016-01-03 21:14:30 +01:00
|
|
|
|
## Credits
|
2015-11-16 10:01:03 +08:00
|
|
|
|
|
2015-12-28 15:52:44 +02:00
|
|
|
|
* [Twin – A Design Pattern for Modeling Multiple Inheritance](http://www.ssw.uni-linz.ac.at/Research/Papers/Moe99/Paper.pdf)
|