CSC/ECE 517 Fall 2012/ch1 1w23 as

From Expertiza_Wiki
Revision as of 02:08, 12 September 2012 by Snallan (talk | contribs)
Jump to navigation Jump to search

1w23: Multiple Inheritance and Mixins

Introduction

Multiple Inheritance

Multiple Inheritance is a technique of establishing hierarchical relationships within a set of classes, such that a single class can inherit  behaviors from multiple parent classes. Although it might seem useful, to include methods from multiple classes, the major issue with multiple inheritance is the ambiguity in referencing the parent class methods,  when more than one parent classes share a method with the same name.This ambiguity is predominant in cases where the inheritance hierarchy is more than one level deep, where the class in the lowermost level inherits from two classes, that have overridden the same method from their parent in different ways.Now the class in the lowermost level has two different implementations of its grand-parent’s method resulting in an ambiguous situation, which is otherwise called as the Deadly Diamond of Death problem.

A Real World Example

Issues of Multiple Inheritance