Enviar pesquisa
Carregar
Inheritance
•
Transferir como PPT, PDF
•
0 gostou
•
1,083 visualizações
Nicole Ryan
Seguir
Inheritance and polymorphism in Python programming
Leia menos
Leia mais
Educação
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 14
Baixar agora
Recomendados
Python Dictionaries and Sets
Python Dictionaries and Sets
Nicole Ryan
Eo gaddis java_chapter_09_5e
Eo gaddis java_chapter_09_5e
Gina Bullock
Eo gaddis java_chapter_09_5e
Eo gaddis java_chapter_09_5e
Gina Bullock
Eo gaddis java_chapter_03_5e
Eo gaddis java_chapter_03_5e
Gina Bullock
Lecture 3
Lecture 3
talha ijaz
Eo gaddis java_chapter_06_Classes and Objects
Eo gaddis java_chapter_06_Classes and Objects
Gina Bullock
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5e
Gina Bullock
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5e
Gina Bullock
Recomendados
Python Dictionaries and Sets
Python Dictionaries and Sets
Nicole Ryan
Eo gaddis java_chapter_09_5e
Eo gaddis java_chapter_09_5e
Gina Bullock
Eo gaddis java_chapter_09_5e
Eo gaddis java_chapter_09_5e
Gina Bullock
Eo gaddis java_chapter_03_5e
Eo gaddis java_chapter_03_5e
Gina Bullock
Lecture 3
Lecture 3
talha ijaz
Eo gaddis java_chapter_06_Classes and Objects
Eo gaddis java_chapter_06_Classes and Objects
Gina Bullock
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5e
Gina Bullock
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5e
Gina Bullock
Object Oriented Relationships
Object Oriented Relationships
Taher Barodawala
Data modeling
Data modeling
Tala Alnaber
Introduction to Classes and Objects
Introduction to Classes and Objects
primeteacher32
Inheritance and polymorphism
Inheritance and polymorphism
baabtra.com - No. 1 supplier of quality freshers
Inheritance and its necessity in java.ppt
Inheritance and its necessity in java.ppt
ssuserf170c4
Inheritance
Inheritance
hccit
07. Class Diagram.ppt
07. Class Diagram.ppt
RandomFunclips
Testing and Improving Performance
Testing and Improving Performance
Nicole Ryan
Optimizing a website for search engines
Optimizing a website for search engines
Nicole Ryan
Javascript programming using the document object model
Javascript programming using the document object model
Nicole Ryan
Working with Video and Audio
Working with Video and Audio
Nicole Ryan
Working with Images
Working with Images
Nicole Ryan
Creating Visual Effects and Animation
Creating Visual Effects and Animation
Nicole Ryan
Creating and Processing Web Forms
Creating and Processing Web Forms
Nicole Ryan
Organizing Content with Lists and Tables
Organizing Content with Lists and Tables
Nicole Ryan
Social media and your website
Social media and your website
Nicole Ryan
Working with Links
Working with Links
Nicole Ryan
Formatting text with CSS
Formatting text with CSS
Nicole Ryan
Laying Out Elements with CSS
Laying Out Elements with CSS
Nicole Ryan
Getting Started with CSS
Getting Started with CSS
Nicole Ryan
Structure Web Content
Structure Web Content
Nicole Ryan
Getting Started with your Website
Getting Started with your Website
Nicole Ryan
Mais conteúdo relacionado
Semelhante a Inheritance
Object Oriented Relationships
Object Oriented Relationships
Taher Barodawala
Data modeling
Data modeling
Tala Alnaber
Introduction to Classes and Objects
Introduction to Classes and Objects
primeteacher32
Inheritance and polymorphism
Inheritance and polymorphism
baabtra.com - No. 1 supplier of quality freshers
Inheritance and its necessity in java.ppt
Inheritance and its necessity in java.ppt
ssuserf170c4
Inheritance
Inheritance
hccit
07. Class Diagram.ppt
07. Class Diagram.ppt
RandomFunclips
Semelhante a Inheritance
(7)
Object Oriented Relationships
Object Oriented Relationships
Data modeling
Data modeling
Introduction to Classes and Objects
Introduction to Classes and Objects
Inheritance and polymorphism
Inheritance and polymorphism
Inheritance and its necessity in java.ppt
Inheritance and its necessity in java.ppt
Inheritance
Inheritance
07. Class Diagram.ppt
07. Class Diagram.ppt
Mais de Nicole Ryan
Testing and Improving Performance
Testing and Improving Performance
Nicole Ryan
Optimizing a website for search engines
Optimizing a website for search engines
Nicole Ryan
Javascript programming using the document object model
Javascript programming using the document object model
Nicole Ryan
Working with Video and Audio
Working with Video and Audio
Nicole Ryan
Working with Images
Working with Images
Nicole Ryan
Creating Visual Effects and Animation
Creating Visual Effects and Animation
Nicole Ryan
Creating and Processing Web Forms
Creating and Processing Web Forms
Nicole Ryan
Organizing Content with Lists and Tables
Organizing Content with Lists and Tables
Nicole Ryan
Social media and your website
Social media and your website
Nicole Ryan
Working with Links
Working with Links
Nicole Ryan
Formatting text with CSS
Formatting text with CSS
Nicole Ryan
Laying Out Elements with CSS
Laying Out Elements with CSS
Nicole Ryan
Getting Started with CSS
Getting Started with CSS
Nicole Ryan
Structure Web Content
Structure Web Content
Nicole Ryan
Getting Started with your Website
Getting Started with your Website
Nicole Ryan
Chapter 12 Lecture: GUI Programming, Multithreading, and Animation
Chapter 12 Lecture: GUI Programming, Multithreading, and Animation
Nicole Ryan
Chapter 11: Object Oriented Programming Part 2
Chapter 11: Object Oriented Programming Part 2
Nicole Ryan
Intro to Programming: Modularity
Intro to Programming: Modularity
Nicole Ryan
Programming Logic and Design: Arrays
Programming Logic and Design: Arrays
Nicole Ryan
Programming Logic and Design: Working with Data
Programming Logic and Design: Working with Data
Nicole Ryan
Mais de Nicole Ryan
(20)
Testing and Improving Performance
Testing and Improving Performance
Optimizing a website for search engines
Optimizing a website for search engines
Javascript programming using the document object model
Javascript programming using the document object model
Working with Video and Audio
Working with Video and Audio
Working with Images
Working with Images
Creating Visual Effects and Animation
Creating Visual Effects and Animation
Creating and Processing Web Forms
Creating and Processing Web Forms
Organizing Content with Lists and Tables
Organizing Content with Lists and Tables
Social media and your website
Social media and your website
Working with Links
Working with Links
Formatting text with CSS
Formatting text with CSS
Laying Out Elements with CSS
Laying Out Elements with CSS
Getting Started with CSS
Getting Started with CSS
Structure Web Content
Structure Web Content
Getting Started with your Website
Getting Started with your Website
Chapter 12 Lecture: GUI Programming, Multithreading, and Animation
Chapter 12 Lecture: GUI Programming, Multithreading, and Animation
Chapter 11: Object Oriented Programming Part 2
Chapter 11: Object Oriented Programming Part 2
Intro to Programming: Modularity
Intro to Programming: Modularity
Programming Logic and Design: Arrays
Programming Logic and Design: Arrays
Programming Logic and Design: Working with Data
Programming Logic and Design: Working with Data
Último
PROCESS RECORDING FORMAT.docx
PROCESS RECORDING FORMAT.docx
PoojaSen20
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
Maestría en Comunicación Digital Interactiva - UNR
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
TechSoup
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
Thiyagu K
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
TechSoup
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
National Information Standards Organization (NISO)
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
VishalSingh1417
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
iammrhaywood
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
Association for Project Management
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
RAM LAL ANAND COLLEGE, DELHI UNIVERSITY.
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
misteraugie
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
VishalSingh1417
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Celine George
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
Jayanti Pande
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
Thiyagu K
Último
(20)
PROCESS RECORDING FORMAT.docx
PROCESS RECORDING FORMAT.docx
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
Inheritance
1.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley C HA PT E R 11 Inheritance
2.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Topics Introduction to Inheritance Polymorphism
3.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Introduction to Inheritance In the real world, many objects are a specialized version of more general objects Example: grasshoppers and bees are specialized types of insect In addition to the general insect characteristics, they have unique characteristics: Grasshoppers can jump Bees can sting, make honey, and build hives
4.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Introduction to Inheritance (cont’d.)
5.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Inheritance and the “Is a” Relationship “Is a” relationship: exists when one object is a specialized version of another object Specialized object has all the characteristics of the general object plus unique characteristics Example: Rectangle is a shape Daisy is a flower
6.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Inheritance and the “Is a” Relationship (cont’d.) Inheritance: used to create an “is a” relationship between classes Superclass (base class): a general class Subclass (derived class): a specialized class An extended version of the superclass Inherits attributes and methods of the superclass New attributes and methods can be added
7.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Inheritance and the “Is a” Relationship (cont’d.) For example, need to create classes for cars, pickup trucks, and SUVs All are automobiles Have a make, year model, mileage, and price This can be the attributes for the base class In addition: Car has a number of doors Pickup truck has a drive type SUV has a passenger capacity
8.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Inheritance and the “Is a” Relationship (cont’d.) In a class definition for a subclass: To indicate inheritance, the superclass name is placed in parentheses after subclass name Example: class Car(Automobile): The initializer method of a subclass calls the initializer method of the superclass and then initializes the unique data attributes Add method definitions for unique methods
9.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Inheritance in UML Diagrams • In UML diagram, show inheritance by drawing a line with an open arrowhead from subclass to superclass
10.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley
11.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Polymorphism Polymorphism: an object’s ability to take different forms Essential ingredients of polymorphic behavior: Ability to define a method in a superclass and override it in a subclass Subclass defines method with the same name Ability to call the correct version of overridden method depending on the type of object that called for it
12.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Polymorphism (cont’d.) In previous inheritance examples showed how to override the __init__ method Called superclass __init__ method and then added onto that The same can be done for any other method The method can call the superclass equivalent and add to it, or do something completely different
13.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley The isinstance Function Polymorphism provides great flexibility when designing programs AttributeError exception: raised when a method is receives an object which is not an instance of the right class isinstance function: determines whether object is an instance of a class Format: isinstance(object, class)
14.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Summary This chapter covered: Inheritance, including: “Is a” relationships Subclasses and superclasses Defining subclasses and initializer methods Depicting inheritance in UML diagrams Polymorphism The isinstance function
Baixar agora