2015-11-14 17:38:35 +08:00
|
|
|
|
---
|
|
|
|
|
layout: pattern
|
|
|
|
|
title: Twin
|
|
|
|
|
folder: twin
|
|
|
|
|
permalink: /patterns/twin/
|
2019-12-13 21:09:28 +02:00
|
|
|
|
categories: Structural
|
2015-12-28 15:52:44 +02:00
|
|
|
|
tags:
|
2019-12-13 21:09:28 +02:00
|
|
|
|
- Extensibility
|
2015-11-14 17:38:35 +08:00
|
|
|
|
---
|
|
|
|
|
|
2016-01-03 21:14:30 +01:00
|
|
|
|
## Intent
|
2019-12-13 21:09:28 +02:00
|
|
|
|
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
|
|
|
|
|
|
2019-12-07 20:01:13 +02:00
|
|
|
|
## Class diagram
|
2015-11-14 17:38:35 +08:00
|
|
|
|

|
|
|
|
|
|
2016-01-03 21:14:30 +01:00
|
|
|
|
## Applicability
|
|
|
|
|
Use the Twin idiom when
|
2015-11-14 17:38:35 +08:00
|
|
|
|
|
2019-12-13 21:09:28 +02:00
|
|
|
|
* To simulate multiple inheritance in a language that does not support this feature.
|
|
|
|
|
* To avoid certain problems of multiple inheritance such as name clashes.
|
2015-11-16 10:01:03 +08:00
|
|
|
|
|
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)
|