I have an array of 4 objects, each of these objects are initialised with a non default constructor however the same variables are used for all 4 with no changes required. This code works, however I would like to know if there is a less code dense way of initialising each object as each of the array elements are just being initialised with the same values?
Class1.h:
std::array<Arrow, 4> skillArrow
Class1.cpp:
Class1::Class1() : skillArrow{ Arrow("gfx/leftArrow.png", mouse, input), Arrow("gfx/leftArrow.png", mouse, input), Arrow("gfx/leftArrow.png", mouse, input), Arrow("gfx/leftArrow.png", mouse, input)
{
}
Arrow.h:
Arrow(const char* filePath, Sprite *mouseSprite, Input *input);