PIC10B_lecture6

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

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

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

View Full Document

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

View Full Document

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

View Full Document
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

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online