When creating an object in C++ I would like to create the object and call a function inside that object at the same time. For instance, say I have a "Level" class and inside that class there is a function that loads the level called "load(string level)".
Instead of doing this:
Level level;
level.load("level1");
Is there any way to do something like this:
Level level = new Level("level1").load; // I believe this is possible in Java, however it has been quite a while since I programmed in Java.
And I know that the "new" keyword functions a lot different in C++ than it does in Java, so I have been reluctant to try anything that included using it. It is not that big of an issue I just think it looks nicer when it's all on one line.