Hey,
I bought your book a couple of days ago. Working on the Snake chapter atm. Nice to read I think using pointers etc. is okay ... I for myself try to avoid them and will exchange your pointers to smart pointers...but I have a question:
The Game class in chapter 2 -> Building the game class has the method
Window* GetWindow();
why using a pointer instead of this?:
const Window& GetWindow() const;
//EDIT: the const may be ignored, later on it will be stupid to make it return a const Window...
Btw.: I try to be more const correct than the book, but I don't see it as a flaw, since the code is much more readable while learning Nice work so far! I also prefer it over the first book so far!
Edit2:
What does the prefix l_ for function parameters stand for?! LValue?!
Snake::Render(sf::RenderWindow& l_window)
Hi! Thanks for purchasing and reading the book! I'm glad you like it so far.
For the GetWindow() method, you absolutely could use a reference. It actually makes more sense in most cases, unless nullptr is a valid return value, in which case using a pointer would be best. Regarding const correctness, you're absolutely right. That was actually my intention. Shoving everything into one publication just seemed like too much, not to mention it would cause formatting problems every once in a while.
The "l_" prefix stands for local, meaning the argument is local to the function/method. There are better alternatives to using Hungarian notation though, so take that with a grain of salt.