Infosys Interview Question

Related to oops and simple coding question