1
General / [Solved] I don't get this code snippet from the book SFML Game Development
« on: June 29, 2014, 07:30:07 pm »
Greetins y'all !
Well; I'm actually reading SFML Game Development and in the chapter 4, sub-chapter "Handling Player Input" there's something I don't understand.
Here's the code (I explain what I don't understand below):
Where the class Aircraft is (basically) a scene node handling its sf::Sprite, its type, etc...
So, what I don't get here is, if derivedAction() expects two parameters (SceneNode& and sf::Time), why in this snippet it just receives one argument (of type SceneNode&, I assume, since the code changes further in the chapter I can't really be sure it is one or just some "basic key word so it's simpler and lighter").
So yes, I know, as I just said, the code changes so it may just be an example but could somebody explain me if this code would work and (most of all) why?
I have read the documentation about std::function on cppreference and as I understood, this code is not legal.
Maybe I'm just taking a simple example too seriously, if so; I'm sorry to have bothered you.
Thank you !
Well; I'm actually reading SFML Game Development and in the chapter 4, sub-chapter "Handling Player Input" there's something I don't understand.
Here's the code (I explain what I don't understand below):
(click to show/hide)
Where the class Aircraft is (basically) a scene node handling its sf::Sprite, its type, etc...
So, what I don't get here is, if derivedAction() expects two parameters (SceneNode& and sf::Time), why in this snippet it just receives one argument (of type SceneNode&, I assume, since the code changes further in the chapter I can't really be sure it is one or just some "basic key word so it's simpler and lighter").
So yes, I know, as I just said, the code changes so it may just be an example but could somebody explain me if this code would work and (most of all) why?
I have read the documentation about std::function on cppreference and as I understood, this code is not legal.
Maybe I'm just taking a simple example too seriously, if so; I'm sorry to have bothered you.
Thank you !