Skip to content
Snippets Groups Projects

Add some oo exercise

Merged David Chamont requested to merge chamont/cpluspluscourse:add-some-oo-exercise into master
1 file
+ 7
0
Compare changes
  • Side-by-side
  • Inline
@@ -119,10 +119,17 @@ Level 3 : use the genericity of the Complex class and play with Complex of integ
### smartPointer
Here we have four code snippets that will benefit from using smart pointers.
<<<<<<< HEAD
* `problem1` is a simple case of usage of `make_unique` with an observer pattern where the raw pointer should be used.
* `problem2` is an example of a collection of pointers. Move semantic has to be used to transfer ownership of newly created objects to the container (alternatively, `emplace_back`).
* `problem3` is an example of shared ownership where `std::shared_pointer` should be used.
* `problem4` demonstrates the usage of `shared_ptr` as class members. It has a second part where a `weak_ptr` can be used, but can be skipped if not enough time.
=======
* `problem1` is a simple case of usage of `make_unique` with an observer pattern where the raw pointer shoule be used.
* `problem2` is an example of a collection of pointers. Move semantic has to be used to transfer ownership of newly created objects to the container.
* `problem3` is an example of shared ownership where `std::shared_pointer` should be used.
* `problem4()` is the most difficult. Skip if not enough time. It has the same flow as the memcheck problem, that destructor should be virtual in the Base class
>>>>>>> moved smartPointer in the right place in the CheatSheet
### stl
The goal is to use STL algorithms. I would advise to start in this order :
Loading