I assume this is because rock is taking a parameter. But in Game:Game, how am I supposed to define something here to satisfy this error? I tried making the Rock object in Game a pointer by that crashes the program.
If I had to pass any argument into the Rock constructor, how do I satisfy it in the Game class?
Title: Re: Passing arguments in classes - Error: no function to call
Post by: Laurent on September 19, 2017, 11:13:37 am
The same way you pass the arguments to the window constructor
Game::Game(): _window(sf::VideoMode(WIDTH, HEIGHT), "ROCK"), _rock(player)// I assume that your Rock instance is named "_rock", and that you have a Player instance named "player" { }
PS: this is the SFML forum, so we try to focus on SFML specific problems; there are better places for general C++ questions