PIC10B_lecture6

PIC10B_lecture6 - Vectors of both base type and derived...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Vectors of both base type and derived type Functions calls by the vector: which function? Virtual functions Polymorphism and Virtual Functions A. Barbaro UCLA PIC 10B Vectors of both base type and derived type Functions calls by the vector: which function? Virtual functions Outline for Today: Polymorphism (8.4 of Big C++ ) 1 Vectors of both base type and derived type 2 Functions calls by the vector: which function? 3 Virtual functions Vectors of both base type and derived type Functions calls by the vector: which function? Virtual functions Vectors, revisited Occasionally, you might be tempted to put members of a base class and members of its derived class into the same vector (For example, it seems like a natural approach to do this on your homework, with the Vehicle class and its derived classes.) Vectors of both base type and derived type Functions calls by the vector: which function? Virtual functions Vectors, revisited Occasionally, you might be tempted to put members of a base class and members of its derived class into the same vector (For example, it seems like a natural approach to do this on your homework, with the Vehicle class and its derived classes.) Strictly speaking, you can’t do this because the derived classes have extra features Vectors of both base type and derived type Functions calls by the vector: which function?Functions calls by the vector: which function?...
View Full Document

This note was uploaded on 10/23/2011 for the course PIC 10B taught by Professor Wittman during the Winter '08 term at UCLA.

Page1 / 14

PIC10B_lecture6 - Vectors of both base type and derived...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online