Infosys interview question

Basic oops concept