SlideShare a Scribd company logo
1 of 25
Inheritance & UML More Advanced UML
Objectives ,[object Object],[object Object],[object Object]
Relationships between classes ,[object Object],[object Object],[object Object],[object Object]
Inheritance hierarchy
Inheritance ,[object Object],[object Object],[object Object],[object Object],[object Object]
Basic class description ,[object Object],[object Object],[object Object],[object Object]
Inheritance Representation (UML) ,[object Object],[object Object],[object Object]
Composition ,[object Object],[object Object],[object Object],[object Object],[object Object]
Different UML Diagrams ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Problem Analysis: Game ,[object Object]
What are the Objects (Classes)? ,[object Object],[object Object]
What are the Operations/Methods? ,[object Object],[object Object]
Class Diagram 1: Frog ,[object Object],[object Object],[object Object],hop () leap () drown () X: integer Y: integer Frog
Class Diagram 2: Highway ,[object Object],[object Object],[object Object],X: integer Y: integer Highway
Class Diagram 3: Truck ,[object Object],[object Object],[object Object],drive () X: integer Y: integer Direction: String Truck
Define Operation Visibility ,[object Object],[object Object],[object Object],Public operations Protected  operations Private operations
How Is Visibility Noted? ,[object Object],[object Object],[object Object],[object Object],Class - privateAttribute # protectedAttribute +publicOp() # protectedOp() - privateOp()
Example: Define Operations Variable Name : Type Function Return Type Student - name : String - dateOfBirth : Date + canEnroll() : Boolean # hasTakenPrerequisites() : Boolean # hasScheduleConflict() : Boolean
Class Relationship ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example:  Single Inheritance ,[object Object],Truck tonnage GroundVehicle weight licenseNumber Car owner register( ) getTax( ) Person 0..* Trailer 1 ancestor decendent generalization size
What is Multiple Inheritance? ,[object Object],Use multiple inheritance only when needed, and  always with caution ! Airplane Helicopter Wolf Horse FlyingThing Animal Bird multiple inheritance
Multiple Inheritance: Problems Name clashes  on  attributes or operations Repeated inheritance FlyingThing color getColor  Animal color getColor  Bird Resolution of these problems is implementation-dependent FlyingThing Animal Bird AnimateObject color
Inheritance vs. Aggregation ,[object Object],[object Object],[object Object],A WindowWithScrollbar “is a” Window A WindowWithScrollbar “has a” Scrollbar Scrollbar Window WindowWithScrollbar 1 1 Window WindowWithScrollbar Scrollbar
Example: Composition (has-a) notifyOfferingSelection(offering : CourseOffering) RegistrationController getOfferings(curriculum) new(context : SecureUser) saveSchedule(sched : Schedule) cancelSchedule(sched : Schedule) <<control>> MaintainScheduleForm displayOfferings() selectCurriculum() : Curriculum selectOffering() : CourseOffering save() cancel() update(changedItem : ISubject) displaySchedule() <<boundary>> 1 1
Generalization to Support Polymorphism Without Polymorphism With Polymorphism ,[object Object],[object Object],[object Object],[object Object],[object Object],do the Animal talk Animal talk () Lion Tiger talk () talk ()

More Related Content

What's hot

What's hot (18)

inheritance in C++
inheritance in C++inheritance in C++
inheritance in C++
 
Intro tooop
Intro tooopIntro tooop
Intro tooop
 
Concept of OOPS with real life examples
Concept of OOPS with real life examplesConcept of OOPS with real life examples
Concept of OOPS with real life examples
 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In Java
 
Inheritance in C++
Inheritance in C++Inheritance in C++
Inheritance in C++
 
Multiple Inheritance
Multiple InheritanceMultiple Inheritance
Multiple Inheritance
 
Oop scala
Oop scalaOop scala
Oop scala
 
Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)
 
Inheritance, Object Oriented Programming
Inheritance, Object Oriented ProgrammingInheritance, Object Oriented Programming
Inheritance, Object Oriented Programming
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
EASY TO LEARN INHERITANCE IN C++
EASY TO LEARN INHERITANCE IN C++EASY TO LEARN INHERITANCE IN C++
EASY TO LEARN INHERITANCE IN C++
 
Learn java objects inheritance-overriding-polymorphism
Learn java objects  inheritance-overriding-polymorphismLearn java objects  inheritance-overriding-polymorphism
Learn java objects inheritance-overriding-polymorphism
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance in c++ part1
Inheritance in c++ part1Inheritance in c++ part1
Inheritance in c++ part1
 
inheritance
inheritanceinheritance
inheritance
 
INHERITANCE(OOP's CONCEPT)
INHERITANCE(OOP's CONCEPT)INHERITANCE(OOP's CONCEPT)
INHERITANCE(OOP's CONCEPT)
 
Inheritance
InheritanceInheritance
Inheritance
 
OOP programming
OOP programmingOOP programming
OOP programming
 

Similar to 09 inheritance and_uml

Descriptions of class diagrams in software
Descriptions of class diagrams in softwareDescriptions of class diagrams in software
Descriptions of class diagrams in softwaressuser9d62d6
 
Object Oriented Technologies
Object Oriented TechnologiesObject Oriented Technologies
Object Oriented TechnologiesTushar B Kute
 
Unified modeling language
Unified modeling languageUnified modeling language
Unified modeling languageamity2j
 
Introduction to Java Object Oiented Concepts and Basic terminologies
Introduction to Java Object Oiented Concepts and Basic terminologiesIntroduction to Java Object Oiented Concepts and Basic terminologies
Introduction to Java Object Oiented Concepts and Basic terminologiesTabassumMaktum
 
Java for android developers
Java for android developersJava for android developers
Java for android developersAly Abdelkareem
 
The Scala Programming Language
The Scala Programming LanguageThe Scala Programming Language
The Scala Programming Languageleague
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental PrinciplesIntro C# Book
 
Introduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdfIntroduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdfTARGARYEN001
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering Madhar Khan Pathan
 
Question and answer Programming
Question and answer ProgrammingQuestion and answer Programming
Question and answer ProgrammingInocentshuja Ahmad
 
Stepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaStepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaDerek Chen-Becker
 
com-213-unified-modelling-launguage-programming-theory.pdf
com-213-unified-modelling-launguage-programming-theory.pdfcom-213-unified-modelling-launguage-programming-theory.pdf
com-213-unified-modelling-launguage-programming-theory.pdfAhmadInternetCafe
 
Unit 2(advanced class modeling & state diagram)
Unit  2(advanced class modeling & state diagram)Unit  2(advanced class modeling & state diagram)
Unit 2(advanced class modeling & state diagram)Manoj Reddy
 
Introductiontoprogramminginscala
IntroductiontoprogramminginscalaIntroductiontoprogramminginscala
IntroductiontoprogramminginscalaAmuhinda Hungai
 

Similar to 09 inheritance and_uml (20)

Intro uml
Intro umlIntro uml
Intro uml
 
Descriptions of class diagrams in software
Descriptions of class diagrams in softwareDescriptions of class diagrams in software
Descriptions of class diagrams in software
 
Object Oriented Technologies
Object Oriented TechnologiesObject Oriented Technologies
Object Oriented Technologies
 
Unified modeling language
Unified modeling languageUnified modeling language
Unified modeling language
 
Introduction to Java Object Oiented Concepts and Basic terminologies
Introduction to Java Object Oiented Concepts and Basic terminologiesIntroduction to Java Object Oiented Concepts and Basic terminologies
Introduction to Java Object Oiented Concepts and Basic terminologies
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
 
Scala google
Scala google Scala google
Scala google
 
Java for android developers
Java for android developersJava for android developers
Java for android developers
 
Google06
Google06Google06
Google06
 
The Scala Programming Language
The Scala Programming LanguageThe Scala Programming Language
The Scala Programming Language
 
Css uml
Css umlCss uml
Css uml
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles
 
Introduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdfIntroduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdf
 
Ontology
OntologyOntology
Ontology
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
Question and answer Programming
Question and answer ProgrammingQuestion and answer Programming
Question and answer Programming
 
Stepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaStepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to Scala
 
com-213-unified-modelling-launguage-programming-theory.pdf
com-213-unified-modelling-launguage-programming-theory.pdfcom-213-unified-modelling-launguage-programming-theory.pdf
com-213-unified-modelling-launguage-programming-theory.pdf
 
Unit 2(advanced class modeling & state diagram)
Unit  2(advanced class modeling & state diagram)Unit  2(advanced class modeling & state diagram)
Unit 2(advanced class modeling & state diagram)
 
Introductiontoprogramminginscala
IntroductiontoprogramminginscalaIntroductiontoprogramminginscala
Introductiontoprogramminginscala
 

Recently uploaded

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 

Recently uploaded (20)

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 

09 inheritance and_uml

  • 1. Inheritance & UML More Advanced UML
  • 2.
  • 3.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. Example: Define Operations Variable Name : Type Function Return Type Student - name : String - dateOfBirth : Date + canEnroll() : Boolean # hasTakenPrerequisites() : Boolean # hasScheduleConflict() : Boolean
  • 19.
  • 20.
  • 21.
  • 22. Multiple Inheritance: Problems Name clashes on attributes or operations Repeated inheritance FlyingThing color getColor Animal color getColor Bird Resolution of these problems is implementation-dependent FlyingThing Animal Bird AnimateObject color
  • 23.
  • 24. Example: Composition (has-a) notifyOfferingSelection(offering : CourseOffering) RegistrationController getOfferings(curriculum) new(context : SecureUser) saveSchedule(sched : Schedule) cancelSchedule(sched : Schedule) <<control>> MaintainScheduleForm displayOfferings() selectCurriculum() : Curriculum selectOffering() : CourseOffering save() cancel() update(changedItem : ISubject) displaySchedule() <<boundary>> 1 1
  • 25.

Editor's Notes

  1. 02/16/11 Operation visibility is the realization of the key object-orientation principle of encapsulation. Public members are accessible directly by any client. Protected members are directly accessible only by instances of subclasses. Private members are directly accessible only by instances of the class to which they are defined. How do you decide what visibility to use? Look at the interaction diagrams on which the operation is referenced. If the message is from outside of the object, use public. If it is from a subclass, use protected. If it’s from itself, use private. You should define the most restrictive visibility possible that will still accomplish the objectives of the class. Client access should be granted explicitly by the class and not taken forcibly. Visibility applies to attributes as well as operations. Attributes are discussed later in this module. UML defines only public/protected/private visibility, not implementation visibility. Implementation visibility should be defined as a property string (UML 1.1, Notation Guide 5.7.2) Re-emphasize that you must define a good abstraction – you must think about what operations are public and private and you must think about encapsulation. It must be done well here for it to be good at the package level.
  2. 02/16/11 In the UML, you can specify the access clients have to attributes and operations. Export control is specified for attributes and operations by preceding the name of the member with the following symbols: + Public # Protected - Private Note that the UML 1.1 Notation Guide explicitly states “A tool may show the visibility indication in a different way, such as by using a special icon …” so the usage of the graphical icons for export control is valid UML.
  3. 02/16/11 In the above example, the student can answer the question of whether it can take a particular offering of a course or not. We must read the description of the operation to understand what rules are considered (e.g. does student’s past schedules include a passing grade for all the courses prerequisites, does students current schedule have a time conflict). If a new rule was added later (e.g. undergraduates can’t take graduate courses) it would go here. That is the value of having an operation that encapsulates a business task (or rule) within a class.
  4. 02/16/11 클래스들 간의 관계는 크게 세가지로 볼 수 있다 . 먼저 계승을 나타내는 IS-A 관계 , member attribute 를 나타내는 aggregation 관계 , 그리고 이 둘이 아닌 일반적인 관계를 들 수 있다 . 이전 단계에서 만든 object diagram 을 보고 이러한 관계성을 찾아내어 클래스 다이어그램에 표시한다 .
  5. 02/16/11 Inheritance is much more than just finding common attribute, operations and relationships. It should be more about the responsibilities and essence of the classes. When building the generalization hierarchies, you should avoid “skyscrapers”; the hierarchies should look like small, independent “forests”. This is general guidance; there may be reasons to break this guideline, just do so consciously. Remember that many levels in an generalization hierarchy affect the understandability of the model. See the Introduction to Object Orientation module for the more formal definition. Some languages do not support generalization. In these cases you will need to update the design model to reflect the characteristics of the implementation language. In cases where the implementation language does not support generalization between classes you must “design generalization in”. Emphasize what happens when a change is made to a super class – the fact that all descendent classes must inherit the change whether they want to or not. Generalization (single inheritance) was introduced in the Introduction to Object Orientation module. This slide was included here, as well, for review purposes.
  6. 02/16/11 See the language-specific appendices for examples of how multiple inheritance is managed in programming environments that support it. Multiple inheritance means that a class can inherit from several other classes. In the above example, Bird inherits from both FlyingThing and Animal. Multiple inheritance is conceptually straightforward and sometimes necessary for modeling the real world accurately. However, there are some potential implementation problems when you use multiple inheritance, and not all implementation languages support it. Thus, be judicial with your use of multiple inheritance. Use it where it accurately describes the concept you are trying to model and reduces the complexity of your model, but be aware that this representation will probably need to be adjusted in design and implementation. Generally, a class inherits from only one class.
  7. 02/16/11 In practice, multiple inheritance is a complex design problem and may lead to implementation difficulties. Two issues associated with multiple inheritance are: 1) Name collisions - both ancestors have attributes and/or operations with the same name, and 2) Repeated inheritance - descendents end up with two copies of an ancestor. See the language-specific appendices for examples of how the multiple inheritance problems are addressed in programming environments that support multiple inheritance.
  8. 02/16/11 The keywords “is a” and “part of” help to determine correct relationship. With Inheritance: Key words “is-a” One object With Aggregation: Key words “part of” Relates multiple objects
  9. 02/16/11 The above example demonstrates how a previous association relationship has been refined into a composition relationship. It was decided that an instance of a RegistrationController would NEVER exist outside the context of a particular Register For Courses Student session. Thus, since the MaintainScheduleForm represents a particular Register For Courses session, a RegistrationController would NEVER exist outside of the context of a particular MaintainScheduleForm. When a MaintainScheduleForm is created, an instance of RegistrationController should always be created. When MaintainScheduleForm is closed, the instance of the RegistrationController should always be deleted. Thus, because they now have coincident lifetimes, composition is used instead of an association.
  10. 02/16/11 Inheritance provides a way to implement polymorphism in cases where polymorphism is implemented the same way for a set of classes. This means that abstract base classes that simply declare inherited operations, but which have no implementations of the operations, and no attributes or associations can be replaced with interfaces. Inheritance now can be (but need not be) restricted to inheritance of implementations only. Polymorphism is not generalization; generalization is one way to implement polymorphism. Polymorphism via generalization is the ability define alternate methods for operations of the ancestor class in the descendent classes. This can reduce the amount of code to be written, as well as help abstract the interface to descendent classes. Polymorphism is an advantage of inheritance realized during implementation and at run-time. Programming environments which support polymorphism use dynamic binding, meaning that the actual code to execute is determined at run-time vs. compile-time. It may be helpful to discuss dynamic binding at this poin; however, try not to get too bogged down in implementation language discussions. Normally the particular method to be executed as a result of a function call is known at compile time. This is called static (or early) binding. The compiler replaces the function call with code telling the program which address to jump to in order to find that function. With polymorphism, the particular type of object for which a method is to be invoked is not known until run time. The compiler cannot provide the address at compile time. The method is selected by the program as it is running This is known as late binding or dynamic linking. See the language-specific appendices for how this is handled by specific programming languages.