CS2_22_Quiz - CS2 Module 22_Quiz Category: OO Concepts...

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

View Full Document Right Arrow Icon
CS2 Module 22_Quiz Category: OO Concepts Topic: Inheritance/Polymorphism Objectives Demystify???
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS 2 Introduction to Object Oriented Programming Module 22_Quiz OO Concepts Inheritance/Polymorphism
Background image of page 2
Three Things! Reference Checking Reference Assignment Dynamic Binding
Background image of page 3

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

View Full DocumentRight Arrow Icon
Reference Checking Occurs during compilation Every method call is checked The type (class) of the reference is examined to make sure that the class OR a parent has the method
Background image of page 4
Quiz Yourself Object o = new Dog(); Animal a = new Dog(); Dog d = new Dog(); o.toString(); o.move(); a.move(); a.bark(); d.toString(); d.scratch(); ((Dog)o).bark(); Which are legal? Object toString Animal move() scratch() Dog move() bark() toString()
Background image of page 5

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

View Full DocumentRight Arrow Icon
Reference Assignment References may be assigned to one another following certain rules. Compile time check!!! The left hand side reference must be the same type as the right hand side OR a reference to an ancestor class Object o = new Dog(); Animal a = new Dog(); Dog d = new Dog(); d = o; d = a; Which are legal?
Background image of page 6
Background image of page 7

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

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

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

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11

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

View Full DocumentRight Arrow Icon
Background image of page 12
Background image of page 13

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

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

This note was uploaded on 01/23/2012 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Institute of Technology.

Page1 / 14

CS2_22_Quiz - CS2 Module 22_Quiz Category: OO Concepts...

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

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