diff options
1 files changed, 12 insertions, 0 deletions
| -rw-r--r-- | Year 1/Object-oriented Programming/Exam 2 Preparation/Automobile.cpp | 12 |
diff --git a/Year 1/Object-oriented Programming/Exam 2 Preparation/Automobile.cpp b/Year 1/Object-oriented Programming/Exam 2 Preparation/Automobile.cpp new file mode 100644 index 0000000..9eb6cc4 --- /dev/null +++ b/Year 1/Object-oriented Programming/Exam 2 Preparation/Automobile.cpp @@ -0,0 +1,12 @@ +#include "Automobile.h" + +Automobile::Automobile(String brand, unsigned maxSpeed) : Vehicle(brand, (maxSpeed >= 180 && maxSpeed <= 240) ? maxSpeed : 180) +{} + +unsigned Automobile::getSpeedOnRoad(Road road) const { + return Vehicle::getMaxSpeed(); +} + +Automobile* Automobile::clone() const { + return new Automobile(*this); +} |
