blob: ee43100e0559547162ad7367f771a7c8d33e250a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include "Minivan.h"
Minivan::Minivan(String brand, unsigned maxSpeed) : Vehicle(brand, (maxSpeed >= 120 && maxSpeed <= 160) ? maxSpeed : 120)
{}
unsigned Minivan::getSpeedOnRoad(Road road) const {
switch (road) {
case Speedy: return Vehicle::getMaxSpeed() / 2;
case ThirdClass: return Vehicle::getMaxSpeed() / 3;
default: return Vehicle::getMaxSpeed();
}
}
Minivan* Minivan::clone() const {
return new Minivan(*this);
}
|