SlideShare a Scribd company logo
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
MULTIPLE INHERITANCE
Muhammad Adil Raja
Roaming Researchers, Inc.
cbna
April 20, 2015
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
OUTLINE I
INTRODUCTION
MULTIPLE INHERITANCE
NAME AMBIGUITY
COMMON ANCESTORS
INNER CLASSES
SUMMARY
REFERENCES
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
INTRODUCTION
• We will investigate some of the problems that can arize
when a language allows a child class to have multiple
parents.
• Name ambiguity.
• Impact on substitution.
• The Problem of Common Ancestors.
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
THE IDEALIZATION OF IS-A RELATIONSHIP
MESSAGE SYNTAX
• In one sense, the process of inheritance is a form of
categorization. A TextWindow is a type of Window, so
class TextWindow inherits from class Window.
• But in the real world, most objects can be categorized in a
variety of ways.
• The author of the textbook is:
• North American.
• Male.
• Professor.
• Parent.
• None of these are proper subsets of the other, and we
cannot make a single rooted inheritance hierarchy out of
them.
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
INHERITANCE AS COMBINATION
• Instead, real world objects are combinations of features
from different classification schemes, each category giving
some new insight into the whole:
• Author is North American, and
• Author is Male, and
• Author is a Professor, and
• Author is a Parent.
• Note that we have not lost the is-a relationship; it still
applies in each case.
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
CS EXAMPLE – COMPLEX NUMBERS
Two abstract classifications
• Magnitude – things that can be compared to each other.
• Number – things that can perform arithmetic.
Three specific classes
• Integer – comparable and arithmetic.
• Char – comparable but not arithmetic.
• Complex – arithmetic but not comparable.
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
POSSIBLE SOLUTIONS
1. Make Number subclass of Magnitude, but redefine
comparison operators in class complex to give error
message if used. (subclassing for limitation)
2. Don’t use inheritance at all – redefine all operators in all
classes. (flattening the inheritance tree).
3. Use part inheritance, but simulate others – use Number,
but have each number implement all relational operators.
4. Make Number and Magnitude independent, and have
Integer inherit from both. (multiple inheritance).
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
INHERITANCE AS A FORM OF COMBINATION
FIGURE : Inheritance.
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
ANOTHER EXAMPLE – WALKING MENUS
• A Menu is a structure charged with displaying itself when
selected by the user.
• A
• Menu maintains a collection of MenuItems.
• Each MenuItem knows how to respond when selected.
• A cascading menu is both a MenuItem and a Menu.
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
PROBLEM WITH MI – NAME AMBUITY
• What happens when same name is used in both parent
classes.
• A
• CardDeck knows how to draw a Card.
• A GraphicalItem knows how to draw an image on a
screen.
• A GraphicalCardDeck should be able to draw. which?
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
ONE SOLUTION – REDEFINITION
One solution is to redefine one or the other operation in the
child class.
REDEFINITION
class GraphicalCardDeck : public CardDeck , public GraphicalObject {
public :
virtual void draw ( ) { return CardDeck : : draw ( ) ; }
virtual void paint ( ) { GraphicalObject : : draw ( ) ; }
}
GraphicalCardDeck gcd ;
gcd−>draw ( ) ; / / selects CardDeck draw
gcd−>paint ( ) ; / / selects GraphicalObject draw
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
PROBLEM WITH REDEFINITION SOLUTION
• The redefinition solution is not without cost, however.
• Now what happens when we run up against the principle of
substitution?
REDEFINITION
GraphicalObject ∗ g = new GraphicalCardDeck ( ) ;
g−>draw ( ) ; / / opps , doing wrong method !
This problem can be mitigated, but the solution is complex and
not perfect.
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
OTHER APPROACHES TO NAME AMBIGUITY
• Other languages use different approaches to solving the
problem of ambiguous names.
• Eiffel uses the ability to rename features from the parent
class.
• A polymorphic variable accessing through the parents
name will access the renamed feature in the child.
• CLOS and Python resolve ambiguous names by the order
in which the parent classes are listed.
• The first occurrence of the name found in a systematic
search is the one selected.
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
MULTIPLE INHERITANCE OF INTERFACES
• Multiple inheritance of interfaces does not present the
same problem of name ambiguity as does multiple
inheritance of classes.
• Either the ambiguous methods in the parent classes have
different type signatures, in which case there is no
problem, or
• The ambiguous methods in the parent classes have the
same signature. Still no problem, since what is inherited is
only a specification, not an implementation.
• This is why Java permits multiple inheritance of interfaces,
not of classes. Nevertheless, C# does not permit the same
method name to be inherited from two parent interfaces.
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
INHERITANCE FROM COMMON ANCESTORS
• Another problem with MI occurs when parent classes have
a common root ancestor.
• Does the new object have one or two instances of the
ancestor?
FIGURE : Inheritance from common ancestors.
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
DATA FIELD IN COMMON ANCESTOR
• Imagine that the common ancestor declares a data
member. Should the child class have one copy of this data
field, or two?
• Both answers can be justified with examples.
• C++ gets around this by introducing the idea of a virtual
parent class.
• If your parent is virtual there is one copy, and if not there is
two.
• Not a perfect solution, and makes the language
complicated.
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
INNER CLASSES
• The ability to next classes in C++ and Java provides a
mechanism that is nearly equivalent to multiple
inheritance, without the semantic problems.
INNER CLASS
class Child extends ParentOne {
. . .
class InnerChild extends ParentTwo {
. . .
/ / can access both parents
}
}
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
SUMMARY
• In this chapter we have explored some of the problems that
arise of the concept of multiple inheritance.
• Name ambiguity.
• Impact on substitution.
• The Problem of Common Ancestors.
Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References
REFERENCES
• Images and content for developing these slides have been
taken from the follwoing book with the permission of the
author.
• An Introduction to Object Oriented Programming, Timothy
Budd.
• This presentation is developed using Beamer:
• Singapore, wolverine.

More Related Content

What's hot

What are Abstract Classes in Java | Edureka
What are Abstract Classes in Java | EdurekaWhat are Abstract Classes in Java | Edureka
What are Abstract Classes in Java | Edureka
Edureka!
 
Java basic
Java basicJava basic
Java basic
Arati Gadgil
 
Control Statements in Java
Control Statements in JavaControl Statements in Java
Control Statements in Java
Niloy Saha
 
Interface in java
Interface in javaInterface in java
Interface in java
PhD Research Scholar
 
Java(Polymorphism)
Java(Polymorphism)Java(Polymorphism)
Java(Polymorphism)
harsh kothari
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
Madishetty Prathibha
 
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B KuteChapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Tushar B Kute
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
Raja Sekhar
 
Hash table in java
Hash table in javaHash table in java
Hash table in java
siriindian
 
Inheritance in Object Oriented Programming
Inheritance in Object Oriented ProgrammingInheritance in Object Oriented Programming
Inheritance in Object Oriented Programming
Ashita Agrawal
 
Templates in c++
Templates in c++Templates in c++
Templates in c++
ThamizhselviKrishnam
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
kamal kotecha
 
Pass by value and pass by reference
Pass by value and pass by reference Pass by value and pass by reference
Pass by value and pass by reference
TurnToTech
 
Multiple inheritance in java3 (1).pptx
Multiple inheritance in java3 (1).pptxMultiple inheritance in java3 (1).pptx
Multiple inheritance in java3 (1).pptx
RkGupta83
 
Overriding
OverridingOverriding
Overriding
adil raja
 
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Udayan Khattry
 
Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in Java
Spotle.ai
 

What's hot (20)

What are Abstract Classes in Java | Edureka
What are Abstract Classes in Java | EdurekaWhat are Abstract Classes in Java | Edureka
What are Abstract Classes in Java | Edureka
 
Java basic
Java basicJava basic
Java basic
 
Control Statements in Java
Control Statements in JavaControl Statements in Java
Control Statements in Java
 
Interface in java
Interface in javaInterface in java
Interface in java
 
Inheritance C#
Inheritance C#Inheritance C#
Inheritance C#
 
Java(Polymorphism)
Java(Polymorphism)Java(Polymorphism)
Java(Polymorphism)
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
 
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B KuteChapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Java interface
Java interfaceJava interface
Java interface
 
Hash table in java
Hash table in javaHash table in java
Hash table in java
 
27 applet programming
27  applet programming27  applet programming
27 applet programming
 
Inheritance in Object Oriented Programming
Inheritance in Object Oriented ProgrammingInheritance in Object Oriented Programming
Inheritance in Object Oriented Programming
 
Templates in c++
Templates in c++Templates in c++
Templates in c++
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
Pass by value and pass by reference
Pass by value and pass by reference Pass by value and pass by reference
Pass by value and pass by reference
 
Multiple inheritance in java3 (1).pptx
Multiple inheritance in java3 (1).pptxMultiple inheritance in java3 (1).pptx
Multiple inheritance in java3 (1).pptx
 
Overriding
OverridingOverriding
Overriding
 
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
 
Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in Java
 

Viewers also liked

Inheritance in OOPS
Inheritance in OOPSInheritance in OOPS
Inheritance in OOPS
Ronak Chhajed
 
I2C programming with C and Arduino
I2C programming with C and ArduinoI2C programming with C and Arduino
I2C programming with C and Arduino
sato262
 
Protols used in bluetooth
Protols used in bluetoothProtols used in bluetooth
Protols used in bluetooth
Sonali Parab
 
Introduction to Embedded System
Introduction to Embedded SystemIntroduction to Embedded System
Introduction to Embedded System
Emertxe Information Technologies Pvt Ltd
 
Object-Oriented Design: Multiple inheritance (C++ and C#)
Object-Oriented Design: Multiple inheritance (C++ and C#)Object-Oriented Design: Multiple inheritance (C++ and C#)
Object-Oriented Design: Multiple inheritance (C++ and C#)
Adair Dingle
 
I2C Protocol
I2C ProtocolI2C Protocol
I2C Protocol
Abhijeet kapse
 
Compiler in System Programming/Code Optimization techniques in System Program...
Compiler in System Programming/Code Optimization techniques in System Program...Compiler in System Programming/Code Optimization techniques in System Program...
Compiler in System Programming/Code Optimization techniques in System Program...
Janki Shah
 
Arm processor
Arm processorArm processor
Arm processor
SHREEHARI WADAWADAGI
 
Arm developement
Arm developementArm developement
Arm developement
hirokiht
 
Serial Peripheral Interface
Serial Peripheral InterfaceSerial Peripheral Interface
Serial Peripheral Interface
Anurag Tomar
 
Embedded C - Optimization techniques
Embedded C - Optimization techniquesEmbedded C - Optimization techniques
Embedded C - Optimization techniques
Emertxe Information Technologies Pvt Ltd
 
SPI Protocol
SPI ProtocolSPI Protocol
SPI Protocol
Anurag Tomar
 
Embedded C
Embedded CEmbedded C
I2C Bus (Inter-Integrated Circuit)
I2C Bus (Inter-Integrated Circuit)I2C Bus (Inter-Integrated Circuit)
I2C Bus (Inter-Integrated Circuit)Varun Mahajan
 
Embedded C - Lecture 1
Embedded C - Lecture 1Embedded C - Lecture 1
Embedded C - Lecture 1
Mohamed Abdallah
 
Serial peripheral interface
Serial peripheral interfaceSerial peripheral interface
Serial peripheral interface
Abhijeet kapse
 
Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)
Dhaval Kaneria
 
Code Optimization
Code OptimizationCode Optimization
Code Optimizationguest9f8315
 
Iot
IotIot

Viewers also liked (19)

Inheritance in OOPS
Inheritance in OOPSInheritance in OOPS
Inheritance in OOPS
 
I2C programming with C and Arduino
I2C programming with C and ArduinoI2C programming with C and Arduino
I2C programming with C and Arduino
 
Protols used in bluetooth
Protols used in bluetoothProtols used in bluetooth
Protols used in bluetooth
 
Introduction to Embedded System
Introduction to Embedded SystemIntroduction to Embedded System
Introduction to Embedded System
 
Object-Oriented Design: Multiple inheritance (C++ and C#)
Object-Oriented Design: Multiple inheritance (C++ and C#)Object-Oriented Design: Multiple inheritance (C++ and C#)
Object-Oriented Design: Multiple inheritance (C++ and C#)
 
I2C Protocol
I2C ProtocolI2C Protocol
I2C Protocol
 
Compiler in System Programming/Code Optimization techniques in System Program...
Compiler in System Programming/Code Optimization techniques in System Program...Compiler in System Programming/Code Optimization techniques in System Program...
Compiler in System Programming/Code Optimization techniques in System Program...
 
Arm processor
Arm processorArm processor
Arm processor
 
Arm developement
Arm developementArm developement
Arm developement
 
Serial Peripheral Interface
Serial Peripheral InterfaceSerial Peripheral Interface
Serial Peripheral Interface
 
Embedded C - Optimization techniques
Embedded C - Optimization techniquesEmbedded C - Optimization techniques
Embedded C - Optimization techniques
 
SPI Protocol
SPI ProtocolSPI Protocol
SPI Protocol
 
Embedded C
Embedded CEmbedded C
Embedded C
 
I2C Bus (Inter-Integrated Circuit)
I2C Bus (Inter-Integrated Circuit)I2C Bus (Inter-Integrated Circuit)
I2C Bus (Inter-Integrated Circuit)
 
Embedded C - Lecture 1
Embedded C - Lecture 1Embedded C - Lecture 1
Embedded C - Lecture 1
 
Serial peripheral interface
Serial peripheral interfaceSerial peripheral interface
Serial peripheral interface
 
Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Iot
IotIot
Iot
 

Similar to Multiple Inheritance

Polymorphism
PolymorphismPolymorphism
Polymorphism
Nuha Noor
 
Inheritance and Substitution
Inheritance and SubstitutionInheritance and Substitution
Inheritance and Substitution
adil raja
 
Java programming -Object-Oriented Thinking- Inheritance
Java programming -Object-Oriented Thinking- InheritanceJava programming -Object-Oriented Thinking- Inheritance
Java programming -Object-Oriented Thinking- Inheritance
Jyothishmathi Institute of Technology and Science Karimnagar
 
Unit 3
Unit 3Unit 3
INHERITANCE-Oopc ppt-ta4
INHERITANCE-Oopc ppt-ta4INHERITANCE-Oopc ppt-ta4
INHERITANCE-Oopc ppt-ta4
Ashutosh Makwana
 
SAD04 - Inheritance
SAD04 - InheritanceSAD04 - Inheritance
SAD04 - Inheritance
Michael Heron
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
Skillwise Group
 
Java_notes.ppt
Java_notes.pptJava_notes.ppt
Java_notes.ppt
tuyambazejeanclaude
 
How would you implement multiple inheritance in java
How would you implement multiple inheritance in javaHow would you implement multiple inheritance in java
How would you implement multiple inheritance in javaTyagi2636
 
Java OOPS Concept
Java OOPS ConceptJava OOPS Concept
Java OOPS Concept
Richa Gupta
 
Concepts of oop1
Concepts of oop1Concepts of oop1
Concepts of oop1
SheetalPareek
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
AnsgarMary
 
2CPP07 - Inheritance
2CPP07 - Inheritance2CPP07 - Inheritance
2CPP07 - Inheritance
Michael Heron
 
Multiple inheritance possible in Java
Multiple inheritance possible in JavaMultiple inheritance possible in Java
Multiple inheritance possible in Java
Kurapati Vishwak
 
Multiple inheritance
Multiple inheritanceMultiple inheritance
Multiple inheritance
zindadili
 
Lo15
Lo15Lo15
Lo15
liankei
 
OO relationships between classes
OO relationships between classesOO relationships between classes
OO relationships between classesSujit Kumar
 
Inheritance
InheritanceInheritance
Inheritance
rajshreemuthiah
 
Java inheritance concept, interface, objects, extends
Java inheritance concept, interface, objects, extendsJava inheritance concept, interface, objects, extends
Java inheritance concept, interface, objects, extends
HelariaXavier
 
04 inheritance
04 inheritance04 inheritance
04 inheritance
Sumit Srivastava
 

Similar to Multiple Inheritance (20)

Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Inheritance and Substitution
Inheritance and SubstitutionInheritance and Substitution
Inheritance and Substitution
 
Java programming -Object-Oriented Thinking- Inheritance
Java programming -Object-Oriented Thinking- InheritanceJava programming -Object-Oriented Thinking- Inheritance
Java programming -Object-Oriented Thinking- Inheritance
 
Unit 3
Unit 3Unit 3
Unit 3
 
INHERITANCE-Oopc ppt-ta4
INHERITANCE-Oopc ppt-ta4INHERITANCE-Oopc ppt-ta4
INHERITANCE-Oopc ppt-ta4
 
SAD04 - Inheritance
SAD04 - InheritanceSAD04 - Inheritance
SAD04 - Inheritance
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
 
Java_notes.ppt
Java_notes.pptJava_notes.ppt
Java_notes.ppt
 
How would you implement multiple inheritance in java
How would you implement multiple inheritance in javaHow would you implement multiple inheritance in java
How would you implement multiple inheritance in java
 
Java OOPS Concept
Java OOPS ConceptJava OOPS Concept
Java OOPS Concept
 
Concepts of oop1
Concepts of oop1Concepts of oop1
Concepts of oop1
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
 
2CPP07 - Inheritance
2CPP07 - Inheritance2CPP07 - Inheritance
2CPP07 - Inheritance
 
Multiple inheritance possible in Java
Multiple inheritance possible in JavaMultiple inheritance possible in Java
Multiple inheritance possible in Java
 
Multiple inheritance
Multiple inheritanceMultiple inheritance
Multiple inheritance
 
Lo15
Lo15Lo15
Lo15
 
OO relationships between classes
OO relationships between classesOO relationships between classes
OO relationships between classes
 
Inheritance
InheritanceInheritance
Inheritance
 
Java inheritance concept, interface, objects, extends
Java inheritance concept, interface, objects, extendsJava inheritance concept, interface, objects, extends
Java inheritance concept, interface, objects, extends
 
04 inheritance
04 inheritance04 inheritance
04 inheritance
 

More from adil raja

ANNs.pdf
ANNs.pdfANNs.pdf
ANNs.pdf
adil raja
 
A Software Requirements Specification
A Software Requirements SpecificationA Software Requirements Specification
A Software Requirements Specification
adil raja
 
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
NUAV - A Testbed for Development of Autonomous Unmanned Aerial VehiclesNUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
adil raja
 
DevOps Demystified
DevOps DemystifiedDevOps Demystified
DevOps Demystified
adil raja
 
On Research (And Development)
On Research (And Development)On Research (And Development)
On Research (And Development)
adil raja
 
Simulators as Drivers of Cutting Edge Research
Simulators as Drivers of Cutting Edge ResearchSimulators as Drivers of Cutting Edge Research
Simulators as Drivers of Cutting Edge Research
adil raja
 
The Knock Knock Protocol
The Knock Knock ProtocolThe Knock Knock Protocol
The Knock Knock Protocol
adil raja
 
File Transfer Through Sockets
File Transfer Through SocketsFile Transfer Through Sockets
File Transfer Through Sockets
adil raja
 
Remote Command Execution
Remote Command ExecutionRemote Command Execution
Remote Command Execution
adil raja
 
CMM Level 3 Assessment of Xavor Pakistan
CMM Level 3 Assessment of Xavor PakistanCMM Level 3 Assessment of Xavor Pakistan
CMM Level 3 Assessment of Xavor Pakistan
adil raja
 
Data Warehousing
Data WarehousingData Warehousing
Data Warehousing
adil raja
 
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
adil raja
 
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
adil raja
 
Real-Time Non-Intrusive Speech Quality Estimation for VoIP
Real-Time Non-Intrusive Speech Quality Estimation for VoIPReal-Time Non-Intrusive Speech Quality Estimation for VoIP
Real-Time Non-Intrusive Speech Quality Estimation for VoIP
adil raja
 
VoIP
VoIPVoIP
VoIP
adil raja
 
ULMAN GUI Specifications
ULMAN GUI SpecificationsULMAN GUI Specifications
ULMAN GUI Specifications
adil raja
 
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
adil raja
 
ULMAN-GUI
ULMAN-GUIULMAN-GUI
ULMAN-GUI
adil raja
 
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
adil raja
 

More from adil raja (20)

ANNs.pdf
ANNs.pdfANNs.pdf
ANNs.pdf
 
A Software Requirements Specification
A Software Requirements SpecificationA Software Requirements Specification
A Software Requirements Specification
 
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
NUAV - A Testbed for Development of Autonomous Unmanned Aerial VehiclesNUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
 
DevOps Demystified
DevOps DemystifiedDevOps Demystified
DevOps Demystified
 
On Research (And Development)
On Research (And Development)On Research (And Development)
On Research (And Development)
 
Simulators as Drivers of Cutting Edge Research
Simulators as Drivers of Cutting Edge ResearchSimulators as Drivers of Cutting Edge Research
Simulators as Drivers of Cutting Edge Research
 
The Knock Knock Protocol
The Knock Knock ProtocolThe Knock Knock Protocol
The Knock Knock Protocol
 
File Transfer Through Sockets
File Transfer Through SocketsFile Transfer Through Sockets
File Transfer Through Sockets
 
Remote Command Execution
Remote Command ExecutionRemote Command Execution
Remote Command Execution
 
Thesis
ThesisThesis
Thesis
 
CMM Level 3 Assessment of Xavor Pakistan
CMM Level 3 Assessment of Xavor PakistanCMM Level 3 Assessment of Xavor Pakistan
CMM Level 3 Assessment of Xavor Pakistan
 
Data Warehousing
Data WarehousingData Warehousing
Data Warehousing
 
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
 
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
 
Real-Time Non-Intrusive Speech Quality Estimation for VoIP
Real-Time Non-Intrusive Speech Quality Estimation for VoIPReal-Time Non-Intrusive Speech Quality Estimation for VoIP
Real-Time Non-Intrusive Speech Quality Estimation for VoIP
 
VoIP
VoIPVoIP
VoIP
 
ULMAN GUI Specifications
ULMAN GUI SpecificationsULMAN GUI Specifications
ULMAN GUI Specifications
 
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
 
ULMAN-GUI
ULMAN-GUIULMAN-GUI
ULMAN-GUI
 
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
 

Recently uploaded

2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 

Recently uploaded (20)

2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 

Multiple Inheritance

  • 1. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References MULTIPLE INHERITANCE Muhammad Adil Raja Roaming Researchers, Inc. cbna April 20, 2015
  • 2. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References OUTLINE I INTRODUCTION MULTIPLE INHERITANCE NAME AMBIGUITY COMMON ANCESTORS INNER CLASSES SUMMARY REFERENCES
  • 3. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References INTRODUCTION • We will investigate some of the problems that can arize when a language allows a child class to have multiple parents. • Name ambiguity. • Impact on substitution. • The Problem of Common Ancestors.
  • 4. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References THE IDEALIZATION OF IS-A RELATIONSHIP MESSAGE SYNTAX • In one sense, the process of inheritance is a form of categorization. A TextWindow is a type of Window, so class TextWindow inherits from class Window. • But in the real world, most objects can be categorized in a variety of ways. • The author of the textbook is: • North American. • Male. • Professor. • Parent. • None of these are proper subsets of the other, and we cannot make a single rooted inheritance hierarchy out of them.
  • 5. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References INHERITANCE AS COMBINATION • Instead, real world objects are combinations of features from different classification schemes, each category giving some new insight into the whole: • Author is North American, and • Author is Male, and • Author is a Professor, and • Author is a Parent. • Note that we have not lost the is-a relationship; it still applies in each case.
  • 6. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References CS EXAMPLE – COMPLEX NUMBERS Two abstract classifications • Magnitude – things that can be compared to each other. • Number – things that can perform arithmetic. Three specific classes • Integer – comparable and arithmetic. • Char – comparable but not arithmetic. • Complex – arithmetic but not comparable.
  • 7. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References POSSIBLE SOLUTIONS 1. Make Number subclass of Magnitude, but redefine comparison operators in class complex to give error message if used. (subclassing for limitation) 2. Don’t use inheritance at all – redefine all operators in all classes. (flattening the inheritance tree). 3. Use part inheritance, but simulate others – use Number, but have each number implement all relational operators. 4. Make Number and Magnitude independent, and have Integer inherit from both. (multiple inheritance).
  • 8. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References INHERITANCE AS A FORM OF COMBINATION FIGURE : Inheritance.
  • 9. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References ANOTHER EXAMPLE – WALKING MENUS • A Menu is a structure charged with displaying itself when selected by the user. • A • Menu maintains a collection of MenuItems. • Each MenuItem knows how to respond when selected. • A cascading menu is both a MenuItem and a Menu.
  • 10. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References PROBLEM WITH MI – NAME AMBUITY • What happens when same name is used in both parent classes. • A • CardDeck knows how to draw a Card. • A GraphicalItem knows how to draw an image on a screen. • A GraphicalCardDeck should be able to draw. which?
  • 11. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References ONE SOLUTION – REDEFINITION One solution is to redefine one or the other operation in the child class. REDEFINITION class GraphicalCardDeck : public CardDeck , public GraphicalObject { public : virtual void draw ( ) { return CardDeck : : draw ( ) ; } virtual void paint ( ) { GraphicalObject : : draw ( ) ; } } GraphicalCardDeck gcd ; gcd−>draw ( ) ; / / selects CardDeck draw gcd−>paint ( ) ; / / selects GraphicalObject draw
  • 12. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References PROBLEM WITH REDEFINITION SOLUTION • The redefinition solution is not without cost, however. • Now what happens when we run up against the principle of substitution? REDEFINITION GraphicalObject ∗ g = new GraphicalCardDeck ( ) ; g−>draw ( ) ; / / opps , doing wrong method ! This problem can be mitigated, but the solution is complex and not perfect.
  • 13. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References OTHER APPROACHES TO NAME AMBIGUITY • Other languages use different approaches to solving the problem of ambiguous names. • Eiffel uses the ability to rename features from the parent class. • A polymorphic variable accessing through the parents name will access the renamed feature in the child. • CLOS and Python resolve ambiguous names by the order in which the parent classes are listed. • The first occurrence of the name found in a systematic search is the one selected.
  • 14. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References MULTIPLE INHERITANCE OF INTERFACES • Multiple inheritance of interfaces does not present the same problem of name ambiguity as does multiple inheritance of classes. • Either the ambiguous methods in the parent classes have different type signatures, in which case there is no problem, or • The ambiguous methods in the parent classes have the same signature. Still no problem, since what is inherited is only a specification, not an implementation. • This is why Java permits multiple inheritance of interfaces, not of classes. Nevertheless, C# does not permit the same method name to be inherited from two parent interfaces.
  • 15. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References INHERITANCE FROM COMMON ANCESTORS • Another problem with MI occurs when parent classes have a common root ancestor. • Does the new object have one or two instances of the ancestor? FIGURE : Inheritance from common ancestors.
  • 16. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References DATA FIELD IN COMMON ANCESTOR • Imagine that the common ancestor declares a data member. Should the child class have one copy of this data field, or two? • Both answers can be justified with examples. • C++ gets around this by introducing the idea of a virtual parent class. • If your parent is virtual there is one copy, and if not there is two. • Not a perfect solution, and makes the language complicated.
  • 17. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References INNER CLASSES • The ability to next classes in C++ and Java provides a mechanism that is nearly equivalent to multiple inheritance, without the semantic problems. INNER CLASS class Child extends ParentOne { . . . class InnerChild extends ParentTwo { . . . / / can access both parents } }
  • 18. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References SUMMARY • In this chapter we have explored some of the problems that arise of the concept of multiple inheritance. • Name ambiguity. • Impact on substitution. • The Problem of Common Ancestors.
  • 19. Introduction Multiple Inheritance Name Ambiguity Common Ancestors Inner Classes Summary References REFERENCES • Images and content for developing these slides have been taken from the follwoing book with the permission of the author. • An Introduction to Object Oriented Programming, Timothy Budd. • This presentation is developed using Beamer: • Singapore, wolverine.