SFML community forums

Help => Window => Topic started by: cho9 on July 18, 2009, 08:20:19 pm

Title: Understanding const sf::Input&
Post by: cho9 on July 18, 2009, 08:20:19 pm
Hi,

Can you tell me, why I must make sf::Input Objects as consts.

And what does the '&' after Input mean?

Sorry for me being stupid. I really tried to understand it. Dx
Title: Understanding const sf::Input&
Post by: klusark on July 18, 2009, 10:38:33 pm
It is a const so that the compiler will catch if you accedently reassign it. The & is so that it does not return a copy, but a referance of the original input.
Title: Understanding const sf::Input&
Post by: Nexus on July 19, 2009, 12:11:52 am
You should learn C++ first, references and const are really basics. SFML is a high-level library, which requires you to know the techniques and constructs it works with.

I can understand if you want to see results as fast as possible, but that's the wrong way. You will certainly come across several problems just because you didn't invest the time to learn the language. And that can be very discouraging.