SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Downloaden Sie, um offline zu lesen
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 classication 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 classications
• Magnitude – things that can be compared to each other.
• Number – things that can perform arithmetic.
Three specic 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 redene
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 redene 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 specication, 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
eld, 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.

Weitere ähnliche Inhalte

Was ist angesagt?

Multi level inheritence
Multi level inheritenceMulti level inheritence
Multi level inheritenceRanaMOIN1
 
Inheritance ppt
Inheritance pptInheritance ppt
Inheritance pptNivegeetha
 
Javapolymorphism
JavapolymorphismJavapolymorphism
Javapolymorphismkarthikenlume
 
Unary operator overloading
Unary operator overloadingUnary operator overloading
Unary operator overloadingMd. Ashraful Islam
 
Type casting in java
Type casting in javaType casting in java
Type casting in javaFarooq Baloch
 
Polymorphism
PolymorphismPolymorphism
PolymorphismArif Ansari
 
C++ concept of Polymorphism
C++ concept of  PolymorphismC++ concept of  Polymorphism
C++ concept of Polymorphismkiran Patel
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in javaHitesh Kumar
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++Vishal Patil
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPTPooja Jaiswal
 
Inheritance and its types In Java
Inheritance and its types In JavaInheritance and its types In Java
Inheritance and its types In JavaMD SALEEM QAISAR
 
Abstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core JavaAbstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core JavaMOHIT AGARWAL
 
Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)Gajendra Singh Thakur
 

Was ist angesagt? (20)

Multi level inheritence
Multi level inheritenceMulti level inheritence
Multi level inheritence
 
Java History
Java HistoryJava History
Java History
 
Inheritance ppt
Inheritance pptInheritance ppt
Inheritance ppt
 
Javapolymorphism
JavapolymorphismJavapolymorphism
Javapolymorphism
 
Inheritance
InheritanceInheritance
Inheritance
 
Unary operator overloading
Unary operator overloadingUnary operator overloading
Unary operator overloading
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Type casting in java
Type casting in javaType casting in java
Type casting in java
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Basic of Java
Basic of JavaBasic of Java
Basic of Java
 
Method overloading
Method overloadingMethod overloading
Method overloading
 
C++ concept of Polymorphism
C++ concept of  PolymorphismC++ concept of  Polymorphism
C++ concept of Polymorphism
 
Final keyword in java
Final keyword in javaFinal keyword in java
Final keyword in java
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
polymorphism
polymorphism polymorphism
polymorphism
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPT
 
Inheritance and its types In Java
Inheritance and its types In JavaInheritance and its types In Java
Inheritance and its types In Java
 
Abstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core JavaAbstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core Java
 
Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)
 

Andere mochten auch

I2C programming with C and Arduino
I2C programming with C and ArduinoI2C programming with C and Arduino
I2C programming with C and Arduinosato262
 
Protols used in bluetooth
Protols used in bluetoothProtols used in bluetooth
Protols used in bluetoothSonali Parab
 
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
 
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 developement
Arm developementArm developement
Arm developementhirokiht
 
Serial Peripheral Interface
Serial Peripheral InterfaceSerial Peripheral Interface
Serial Peripheral InterfaceAnurag Tomar
 
SPI Protocol
SPI ProtocolSPI Protocol
SPI ProtocolAnurag Tomar
 
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 1Mohamed Abdallah
 
Serial peripheral interface
Serial peripheral interfaceSerial peripheral interface
Serial peripheral interfaceAbhijeet 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
 

Andere mochten auch (18)

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
 

Ähnlich wie Multiple Inheritance

Polymorphism
PolymorphismPolymorphism
PolymorphismNuha Noor
 
Inheritance and Substitution
Inheritance and SubstitutionInheritance and Substitution
Inheritance and Substitutionadil raja
 
INHERITANCE-Oopc ppt-ta4
INHERITANCE-Oopc ppt-ta4INHERITANCE-Oopc ppt-ta4
INHERITANCE-Oopc ppt-ta4Ashutosh Makwana
 
SAD04 - Inheritance
SAD04 - InheritanceSAD04 - Inheritance
SAD04 - InheritanceMichael Heron
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSkillwise Group
 
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 ConceptRicha Gupta
 
Concepts of oop1
Concepts of oop1Concepts of oop1
Concepts of oop1SheetalPareek
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentalsAnsgarMary
 
2CPP07 - Inheritance
2CPP07 - Inheritance2CPP07 - Inheritance
2CPP07 - InheritanceMichael Heron
 
Multiple inheritance possible in Java
Multiple inheritance possible in JavaMultiple inheritance possible in Java
Multiple inheritance possible in JavaKurapati Vishwak
 
Multiple inheritance
Multiple inheritanceMultiple inheritance
Multiple inheritancezindadili
 
Lo15
Lo15Lo15
Lo15liankei
 
OO relationships between classes
OO relationships between classesOO relationships between classes
OO relationships between classesSujit Kumar
 

Ähnlich wie 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
 
04 inheritance
04 inheritance04 inheritance
04 inheritance
 
Inheritance.pptx
Inheritance.pptxInheritance.pptx
Inheritance.pptx
 

Mehr von adil raja

ANNs.pdf
ANNs.pdfANNs.pdf
ANNs.pdfadil raja
 
A Software Requirements Specification
A Software Requirements SpecificationA Software Requirements Specification
A Software Requirements Specificationadil 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 Vehiclesadil raja
 
DevOps Demystified
DevOps DemystifiedDevOps Demystified
DevOps Demystifiedadil 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 Researchadil raja
 
The Knock Knock Protocol
The Knock Knock ProtocolThe Knock Knock Protocol
The Knock Knock Protocoladil raja
 
File Transfer Through Sockets
File Transfer Through SocketsFile Transfer Through Sockets
File Transfer Through Socketsadil raja
 
Remote Command Execution
Remote Command ExecutionRemote Command Execution
Remote Command Executionadil raja
 
Thesis
ThesisThesis
Thesisadil 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 Pakistanadil raja
 
Data Warehousing
Data WarehousingData Warehousing
Data Warehousingadil 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 VoIPadil raja
 
ULMAN GUI Specifications
ULMAN GUI SpecificationsULMAN GUI Specifications
ULMAN GUI Specificationsadil 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-GUIadil 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
 

Mehr von 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...
 

KĂźrzlich hochgeladen

BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto GonzĂĄlez Trastoy
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 

KĂźrzlich hochgeladen (20)

BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 

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 classication 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 classications • Magnitude – things that can be compared to each other. • Number – things that can perform arithmetic. Three specic 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 redene comparison operators in class complex to give error message if used. (subclassing for limitation) 2. Don’t use inheritance at all – redene 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 redene 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 redenition 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 rst 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 specication, 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 eld, or two? • Both answers can be justied 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.