-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMovie.cpp
More file actions
24 lines (17 loc) · 744 Bytes
/
Movie.cpp
File metadata and controls
24 lines (17 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "Movie.h"
const RegularPriceState Movie::REGULAR_PRICE;
const ChildrenPriceState Movie::CHILDREN_PRICE;
const NewReleasePriceState Movie::NEW_RELEASE_PRICE;
double Movie::getPrice(int nbDayRented) const{
return priceState->calculatePrice(nbDayRented);
}
int Movie::getRenterBonus() const {
return priceState->renterPoint();
}
void Movie::setPriceState(const PriceState *priceState) {
this->priceState = priceState;
}
Movie::Movie(const std::string& title, const PriceState *priceState)
: _title(title), priceState(priceState) {}
ChildrenMovie::ChildrenMovie(const std::string &title) : Movie(title, &CHILDREN_PRICE) {}
NewReleaseMovie::NewReleaseMovie(const std::string &title) : Movie(title, &NEW_RELEASE_PRICE) {}