Cognizant interview question

oops concepts