Cognizant interview question

Oops concept in typescript