Diamond Problem

From CSSEMediaWiki
Jump to: navigation, search

The diamond problem is the name for the ambiguity which can arise when implementing a system using Multiple Inheritance. It is best illustrated with an example: DiamondProblem.png

In this example, the Penguin class does not override the Move() method, and so it is left for the language to decide how the penguin should move.

Various languages handle this in different ways and almost every language handles the problem in a different way. Todo: List common languages supporting multiple inheritance and how they handle the problem.

Personal tools