trainings/CreatingReliableSoftwareCpp/Presentation/exercises/decorator
2024-05-06 11:58:30 +02:00
..
src Reliable - pierwszy commit 2024-05-06 11:58:30 +02:00
tests Reliable - pierwszy commit 2024-05-06 11:58:30 +02:00
CMakeLists.txt Reliable - pierwszy commit 2024-05-06 11:58:30 +02:00
main.cpp Reliable - pierwszy commit 2024-05-06 11:58:30 +02:00
README.md Reliable - pierwszy commit 2024-05-06 11:58:30 +02:00
ships.json Reliable - pierwszy commit 2024-05-06 11:58:30 +02:00

Linux compilation

> mkdir build
> cd build
> cmake -DCMAKE_BUILD_TYPE=Debug ..
> make

Exercise 1

  • Go into directory Ship and implement DecoratedCargo:
    • It should take a std::unique_ptr<Cargo> and has protected getter to this field.
  • Implement Vunreable class:
    • It should inherit from TimeObserver and DecoratedCargo
    • It should take additional parameters in C'tor: Time, durability and maxDurability
    • It should simulate time elapsing. Every day should subtract durability
    • It should return price back on current durability of cargo

Exercise 2

  • Implement Valuable class:
    • It should inherit from DecoratedCargo
    • it should be a template that takes enum type of value
    • It should return value based on type (cast it to enum and multiply by current value)
  • 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.