HCLTech interview question

General OOPS concepts. Simple program