Infosys interview question

Question on oops dsa c++