Lecture16

Lecture16 - A derived class inherits from several unrelated...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS11600: Introduction to Computer Programming (C++) Lecture 16 Svetlozar Nestorov University of Chicago 2/26/2003 Svetlozar Nestorov, CS 116: Intro to Programming II 2 Outline ± Multiple inheritance ± Distinct base classes ± Multiple inclusion ± Virtual base classes 2/26/2003 Svetlozar Nestorov, CS 116: Intro to Programming II 3 Multiple Inheritance ± A derived class with multiple base classes. ± Example (Stroustrup’99): • Task, Displayed, Terminal, Line, Switch ± Controversial feature (or bug?) ± Three different scenarios (patterns): • Distinct base classes • Multiple inclusion • Virtual base classes 2/26/2003 Svetlozar Nestorov, CS 116: Intro to Programming II 4 Distinct Base Classes
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: A derived class inherits from several unrelated base classes. Polymorphism Ambiguities 2/26/2003 Svetlozar Nestorov, CS 116: Intro to Programming II 5 Multiple Inclusion A derived class inherits from the same base class in multiple ways. Contains more than one instance of the base class. Polymorphism Ambiguities 2/26/2003 Svetlozar Nestorov, CS 116: Intro to Programming II 6 Virtual Base Classes Several derived classes share a common base class: A class that inherits from the derived classes contains a single copy of the common base class. Polymorphism Base class intilization...
View Full Document

Ask a homework question - tutors are online