| .. | ||
| src | ||
| tests | ||
| CMakeLists.txt | ||
| main.cpp | ||
| README.md | ||
| ships.json | ||
Linux compilation
> mkdir build
> cd build
> cmake -DCMAKE_BUILD_TYPE=Debug ..
> make
Exercise 1
- Go into directory
Shipand implementDecoratedCargo:- It should take a
std::unique_ptr<Cargo>and has protected getter to this field.
- It should take a
- Implement
Vunreableclass:- It should inherit from
TimeObserverandDecoratedCargo - It should take additional parameters in C'tor:
Time,durabilityandmaxDurability - It should simulate time elapsing. Every day should subtract durability
- It should return price back on current durability of cargo
- It should inherit from
Exercise 2
- Implement
Valuableclass:- It should inherit from
DecoratedCargo - it should be a template that takes
enumtype of value - It should return value based on type (cast it to enum and multiply by current value)
- It should inherit from
- Try to compile code form
main.cpp - You may have some trouble with running code if you don't write a code carefully :) think where is a problem.