Presentation is loading. Please wait.

Presentation is loading. Please wait.

ITK 168 Lecture 5 - Inheritance

Similar presentations


Presentation on theme: "ITK 168 Lecture 5 - Inheritance"— Presentation transcript:

1 ITK 168 Lecture 5 - Inheritance

2 Examples Review ExperimentRobot Lamp example

3 Overriding methods Overriding occurs when a subclass implements a method of the same name as the superclass causing a change in behavior

4 Override example Spinner robot Bad robot
Does 360 spin before turning left Bad robot Turns right when supposed to turn left Turns left when supposed to turn right

5 Method Resolution Robot RobotSE void move() void turnLeft() BadRobot
void turnAround() void turnRight() BadRobot void turnLeft() void turnRight()

6 Overriding with side effects
Speedy


Download ppt "ITK 168 Lecture 5 - Inheritance"

Similar presentations


Ads by Google