What's wrong with my code:
class Game{
private:
mtm::Dimensions dimensions;
std::vector<std::shared_ptr<Character>> board;
};
std::shared_ptr<Character> Game::makeCharacter(CharacterType type, Team team, units_t health,
units_t ammo, units_t range, units_t power) {
std::shared_ptr<Character> out = nullptr;
if (type ==SNIPER)
out=mtm::Sniper(team,health,power,ammo,range);
return out;
}
I get the following error:
no viable overloaded '=' out=mtm::Sniper(team,health,power,ammo,range);
Note: Sniper
inherits from the abstract class Character
.
How may I fix this?