C_CPP/08_PTRN/Car.cpp

20 lines
310 B
C++
Raw Normal View History

2018-03-09 09:47:53 +01:00
#include "Car.hpp"
Car::Car(std::string model, int maxWeight)
: Vehicle(model)
{
_maxWeight = maxWeight;
}
int Car::maxWeight(){
return _maxWeight;
}
int Car::payload_kg(){
return _maxWeight - 75 * 5; // subtract weight of passangers
}
Vehicle* Car::clone(){
return new Car(model(), _maxWeight);
}