Multiple Inheritance Damian Gordon.

Slides:



Advertisements
Similar presentations
Basics of Inheritance CS 5010 Program Design Paradigms "Bootcamp" Lesson 12.1 © Mitchell Wand, This work is licensed under a Creative Commons.
Advertisements

Advanced Class 6. Topics Inheritance Class methods / static methods Class data vs. instance data.
Object Orientated Concepts. Overview  The world is objects  Defining an object  Not a function, it’s a method  Lets inherit want we can  Objects.
People in Design Damian Gordon. People in Design Why do we care about people in design? – Because we build software systems for other people, so we have.
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
CS 106 Introduction to Computer Science I 11 / 20 / 2006 Instructor: Michael Eckmann.
Mail Merge. What is a mail merge? One letter that you want to send to lots of different people.
S A B D C T = 0 S gets message from above and sends messages to A, C and D S.
Inheritance Review/Recap. ClassA extends ClassB ClassA now inherits (can access and use) all public and protected elements of ClassB We can expect the.
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
The Unified Modeling Language (UML) Class Diagrams.
BACS 287 Basics of Object-Oriented Programming 1.
CSE 413 Programming Languages & Implementation Hal Perkins Autumn 2012 Ruby: Multiple Inheritance, Interfaces, Mixins 1.
CS 106 Introduction to Computer Science I 04 / 13 / 2007 Friday the 13 th Instructor: Michael Eckmann.
ICT Functional Skills Prepare an or add some contacts (This is always Question 4)
MSF Design Example Conceptual Design Logical Design Physical Design.
Draw me a table as complete as possible to represent the following data: Time in seconds: Temperature in o C
Inheritance in Petri Net Designs. Goals Subtyping - interface inheritance: Can the subclass use or conform to the interface of the superclass?). Projection.
Adding attachments to s This power point is to help people to know what an attachment is and also I will show you how to do it with screen shots to.
Chapter 12 Object-oriented design for more than one class.
and the business environment Explain what is and how is it used in a business environment A02 .
Get out of your Inbox with Outlook 2007 Use your mail to take action Reading an message usually prompts you to take some sort of action. You might.
Types of Inheritance in C++. In C++ we have 5 different types of inheritance: – Single Inheritance – Multiple Inheritance – Hierarchical Inheritance –
Attention Small Businesses Do you want to become the success you so deserve to be? And lack of capital keeping you from reaching that goal? There is an.
Interfaces, Mixins, & Multiple Inheritance CSE 413 Autumn 2008 Credit: Dan Grossman, CSE341, Sp08.
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
Chapter 2 - OOP Maciej Mensfeld Presented by: Maciej Mensfeld More about OOP dev.mensfeld.pl github.com/mensfeld.
25/2/16. Software Design (UML) ClassName attributes operations A class is a description of a set of objects that share the same attributes, Operations.
Comp1004: Inheritance II Polymorphism. Coming up Inheritance Reminder Overriding methods – Overriding and substitution Dynamic Binding Polymorphism –
Comp1004: Object Oriented Design I Abstract Classes and Interfaces.
CSE 413 Programming Languages & Implementation Hal Perkins Autumn 2012 Multiple Inheritance, Interfaces, Mixins 1.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Object-Orientated Design (Summary)
OOP - Object Oriented Programming
Sections Inheritance and Abstract Classes
DAWN 2000 Status of Dawn-Type Strategies Worldwide Country Status
Copyright © by Curt Hill
How to Create Message Template in Hotmail?
Call Outlook customer support toll free number Ireland.
Advanced Java Programming
UML UML Data Modeling.
Showing Relationships in UML
AFELink Mail Ballot Partner Demo
معلم الصف الثالث الابتدائي
Object-oriented programming
Object Oriented Programming (OOP) LAB # 8
has many aspects that work together to give people almost instant communication from any computer on the internet to any other computer There.
The Object-Oriented Thought Process Chapter 07
CSE341: Programming Languages Section 9 Dynamic Dispatch Manually in Racket Zach Tatlock Winter 2018.
Basic Inheritance Damian Gordon.
Here are some diagrams that might support your teaching of this topic
Java Programming, Second Edition
ФОНД “СОЦИАЛНО ПОДПОМАГАНЕ”
Title of Notes: Common Denominators
Ruby Classes.
Chapter 10: Method Overriding and method Overloading
Extended Learning Module G
Year 3 (National Numeracy Strategy) (Based on DFEE Sample Lessons)
Inheritance and Polymorphism
Object Oriented Programming in A Level
Chapter 5.
Method Overriding and method Overloading
Object Oriented System Design Class Diagrams
Task 3: Three numbers Circle two dice that add to make 6
Programming For Big Data
We are now using Chain SMS to message patients!
Migrating to Object-Oriented Programs
We are now using Chain SMS to message patients!
Chapter 20 Object-Oriented Concepts and Principles
PseudoCode Damian Gordon.
Presentation transcript:

Multiple Inheritance Damian Gordon

Multiple Inheritance A subclass can inherit from multiple superclasses, and have the functionality of all of those superclasses available to it. This is called Multiple Inheritance. It sounds simple, and it is simple, but it is considered a very tricky to implement in a clear way.

Multiple Inheritance The simplest and most useful form of multiple inheritance is called a mixin. A MIXIN is a class that is specifically created to be a superclass that other classes will inherit methods and attributes from. Let’s look at an example:

Multiple Inheritance Let’s say we want to add functionality to our Contact class, to allow us to send an e-mail to self.email. Sending an e-mail is a sufficiently general task that many other classes might use it also. Let’s look at the MIXIN class for e-mailing:

Multiple Inheritance class MailSender: def send_mail(self, message) print(“Sending mail to ” + self.email) # e-mail logic here # END send_mail. # END class.

Multiple Inheritance So now we can create a new class that uses both Contact and our new class MailSender class EmailableContact(Contact,MailSender): # Do stuff # END class.

Multiple Inheritance So defining a class that uses multiple inheritance works a lot like calling a method with a number of parameters. We can test the new program with the following: >>>e = EmailableContact(“John Smith”, “jsmith@Company.com”) >>> e.send_mail(“Hello, test email”) Sending mail to jsmith@Company.com

etc.