I’m trying to use initilization list with object array but I’m not able to figure out hot to pass value in its constructor [closed]

  c++, c++17, initialization, oop
class Physics
{
    protected: 
        float p_m;
    public: 
        Physics(float p_m)
        {
            this->p_m = p_m;
        }
};
class Chemistry
{
    protected: 
        float c_m;
    public: 
        Chemistry(float c_m)
        {
            this->c_m = c_m;
        };
};
class Maths
{
    protected: 
        float m_m;
    public: 
        Maths(float m_m)
        {
            this->m_m = m_m;
        };
};

enter image description here

Source: Windows Questions C++

LEAVE A COMMENT