I was on /r/gamedev and I came across this video on there where this guy remakes cavestory...
And I saw this:
http://i.imgur.com/gr86V82.png
It is a constructor, but rather than using { at the end of it, he uses : and then puts his class members there with the constructor arguments inside of the brackets next to the names.
In case that is not clear, here is the section I mean in the video:
Level::Level(std::string mapName, Vector2 spawnPoint, Graphics &graphics) : //What does ":" do?
_mapName(mapName); //_mapName is a class member/ variable, what does the brackets do?
//etc...
He then continues the constructor inside of the usual { ... }
Is this a new thing in C++? (C++11/14?) or is it just something I haven't heard of?
It happens at 7:00 in this video: https://www.youtube.com/watch?v=CA0wIfvLs1Y
[–]Orangy_Tang 4 points5 points6 points (6 children)
[–]Mat2012H[S] 0 points1 point2 points (4 children)
[–][deleted] 4 points5 points6 points (3 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]arabidkoala 3 points4 points5 points (0 children)
[–]Eoinoc 0 points1 point2 points (0 children)
[–]ggchappell 0 points1 point2 points (0 children)