2021-10-05 11:48:15 +00:00
|
|
|
[< Back](../README.md)
|
2021-10-05 11:44:51 +00:00
|
|
|
|
2021-10-05 11:00:57 +00:00
|
|
|
# Exercise: std::unique_ptr<PacMan>
|
2021-10-05 10:51:55 +00:00
|
|
|
|
2021-10-05 12:29:27 +00:00
|
|
|
## Background:
|
|
|
|
|
2021-10-05 10:51:55 +00:00
|
|
|
(corentin: maybe something about } that destroys things)
|
|
|
|
We are going to play with using std::unique_ptr as we discussed in the slides. Since we will be reverting these changes
|
|
|
|
back, do take a copy of the GameState files before we start. We will change PacMan within GameState into a std::
|
|
|
|
unique_ptr<PacMan>, once this has been done the code will not compile, because there are further changes needed within
|
|
|
|
the GameState class. Go through and figure out what needs to be updated. Can we change one of the ghosts into a std::
|
|
|
|
unique_ptr? Are there any current design problems we will run into? What do these design issues say about ownership of
|
|
|
|
data?
|
2021-10-05 12:29:27 +00:00
|
|
|
|
|
|
|
## Exercise
|
|
|
|
|
|
|
|
1.
|