Common Computer Science References
At the end of this lesson, you will be able to:
understand polymorphism
review "Class Diagrams"
read "Using OOP", Chapter 9, Computer Based Problem Solving
read "Polymorphism"
null
read over and do Lesson 6
for your Vehicle class, using "polymorphism" to change your "brake" methods:
vehicle class uses the same old way
bike uses its original brake method
truck uses a new brake method; since it has air brakes:
we had:
Provide_Air(airPressure: number)
now make this the actual new brake method:
break (breakPower: number, breakTime: number, airPressure: number)
this._speed = this._speed - (breakPower * breakTime) - (airPressure * breakTime)
then change your stub program to use each one of these new methods
do the above in a second language