Sanket Systems interview question

oops concept with some example