CS 61B Spring 2015 Midterm 1 Guide

(select problems.)

8. A Robot Renegade Cop

Line 9: No cast needed. Interfaces can be a static type (Why? Well, first, convince yourself that an interface IS a type. Think about where interfaces are used, for example, as an argument in a function). rCop’s static type is RobotCop, which implements Police (so a RobotCop is a Police).

back up